isaacscript-common 1.0.499 → 1.0.503
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/callbacks/postBombInitLate.lua +3 -17
- package/dist/callbacks/postEffectInitLate.lua +3 -17
- package/dist/callbacks/postFamiliarInitLate.lua +1 -15
- package/dist/callbacks/postKnifeInitLate.lua +3 -17
- package/dist/callbacks/postLaserInitLate.lua +3 -17
- package/dist/callbacks/postNPCInitLate.lua +3 -17
- package/dist/callbacks/postNewRoomEarly.d.ts +2 -0
- package/dist/callbacks/postNewRoomEarly.lua +50 -0
- package/dist/callbacks/postPickupInitLate.lua +3 -17
- package/dist/callbacks/postProjectileInitLate.lua +3 -17
- package/dist/callbacks/postTearInitLate.lua +3 -17
- package/dist/callbacks/subscriptions/postNewRoomEarly.d.ts +4 -0
- package/dist/callbacks/subscriptions/postNewRoomEarly.lua +18 -0
- package/dist/features/deployJSONRoom.lua +16 -16
- package/dist/features/getCollectibleItemPoolType.lua +1 -6
- package/dist/features/saveDataManager/main.lua +5 -3
- package/dist/functions/collectibles.d.ts +5 -5
- package/dist/functions/collectibles.lua +4 -0
- package/dist/functions/flag.d.ts +1 -1
- package/dist/functions/gridEntity.d.ts +8 -2
- package/dist/functions/gridEntity.lua +16 -0
- package/dist/functions/input.d.ts +3 -5
- package/dist/functions/player.d.ts +5 -5
- package/dist/functions/revive.d.ts +2 -2
- package/dist/functions/rooms.d.ts +39 -18
- package/dist/functions/rooms.lua +60 -47
- package/dist/functions/util.d.ts +2 -2
- package/dist/functions/util.lua +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.lua +8 -0
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.d.ts +3 -0
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +12 -0
- package/dist/types/CallbackParametersCustom.d.ts +4 -0
- package/dist/types/ModCallbacksCustom.d.ts +34 -33
- package/dist/types/ModCallbacksCustom.lua +35 -33
- package/dist/types/ModUpgraded.lua +178 -321
- package/dist/upgradeMod.d.ts +2 -2
- package/dist/upgradeMod.lua +9 -6
- package/package.json +2 -2
|
@@ -4,9 +4,6 @@ local ____exports = {}
|
|
|
4
4
|
local hasSubscriptions, postBombUpdate, v
|
|
5
5
|
local ____exports = require("features.saveDataManager.exports")
|
|
6
6
|
local saveDataManager = ____exports.saveDataManager
|
|
7
|
-
local ____rooms = require("functions.rooms")
|
|
8
|
-
local getRoomIndex = ____rooms.getRoomIndex
|
|
9
|
-
local getRoomVisitedCount = ____rooms.getRoomVisitedCount
|
|
10
7
|
local ____postBombInitLate = require("callbacks.subscriptions.postBombInitLate")
|
|
11
8
|
local postBombInitLateFire = ____postBombInitLate.postBombInitLateFire
|
|
12
9
|
local postBombInitLateHasSubscriptions = ____postBombInitLate.postBombInitLateHasSubscriptions
|
|
@@ -17,24 +14,13 @@ function postBombUpdate(self, bomb)
|
|
|
17
14
|
if not hasSubscriptions(nil) then
|
|
18
15
|
return
|
|
19
16
|
end
|
|
20
|
-
local roomIndex = getRoomIndex(nil)
|
|
21
|
-
local roomVisitedCount = getRoomVisitedCount(nil)
|
|
22
|
-
if roomIndex ~= v.run.currentRoomIndex or roomVisitedCount ~= v.run.currentRoomVisitedCount then
|
|
23
|
-
v.run.currentRoomIndex = roomIndex
|
|
24
|
-
v.run.currentRoomVisitedCount = roomVisitedCount
|
|
25
|
-
v.run.firedSet:clear()
|
|
26
|
-
end
|
|
27
17
|
local index = GetPtrHash(bomb)
|
|
28
|
-
if not v.
|
|
29
|
-
v.
|
|
18
|
+
if not v.room.firedSet:has(index) then
|
|
19
|
+
v.room.firedSet:add(index)
|
|
30
20
|
postBombInitLateFire(nil, bomb)
|
|
31
21
|
end
|
|
32
22
|
end
|
|
33
|
-
v = {
|
|
34
|
-
firedSet = __TS__New(Set),
|
|
35
|
-
currentRoomIndex = nil,
|
|
36
|
-
currentRoomVisitedCount = nil
|
|
37
|
-
}}
|
|
23
|
+
v = {room = {firedSet = __TS__New(Set)}}
|
|
38
24
|
function ____exports.postBombInitLateCallbackInit(self, mod)
|
|
39
25
|
saveDataManager(nil, "postBombInitLate", v, hasSubscriptions)
|
|
40
26
|
mod:AddCallback(ModCallbacks.MC_POST_BOMB_UPDATE, postBombUpdate)
|
|
@@ -4,9 +4,6 @@ local ____exports = {}
|
|
|
4
4
|
local hasSubscriptions, postEffectUpdate, v
|
|
5
5
|
local ____exports = require("features.saveDataManager.exports")
|
|
6
6
|
local saveDataManager = ____exports.saveDataManager
|
|
7
|
-
local ____rooms = require("functions.rooms")
|
|
8
|
-
local getRoomIndex = ____rooms.getRoomIndex
|
|
9
|
-
local getRoomVisitedCount = ____rooms.getRoomVisitedCount
|
|
10
7
|
local ____postEffectInitLate = require("callbacks.subscriptions.postEffectInitLate")
|
|
11
8
|
local postEffectInitLateFire = ____postEffectInitLate.postEffectInitLateFire
|
|
12
9
|
local postEffectInitLateHasSubscriptions = ____postEffectInitLate.postEffectInitLateHasSubscriptions
|
|
@@ -17,24 +14,13 @@ function postEffectUpdate(self, effect)
|
|
|
17
14
|
if not hasSubscriptions(nil) then
|
|
18
15
|
return
|
|
19
16
|
end
|
|
20
|
-
local roomIndex = getRoomIndex(nil)
|
|
21
|
-
local roomVisitedCount = getRoomVisitedCount(nil)
|
|
22
|
-
if roomIndex ~= v.run.currentRoomIndex or roomVisitedCount ~= v.run.currentRoomVisitedCount then
|
|
23
|
-
v.run.currentRoomIndex = roomIndex
|
|
24
|
-
v.run.currentRoomVisitedCount = roomVisitedCount
|
|
25
|
-
v.run.firedSet:clear()
|
|
26
|
-
end
|
|
27
17
|
local index = GetPtrHash(effect)
|
|
28
|
-
if not v.
|
|
29
|
-
v.
|
|
18
|
+
if not v.room.firedSet:has(index) then
|
|
19
|
+
v.room.firedSet:add(index)
|
|
30
20
|
postEffectInitLateFire(nil, effect)
|
|
31
21
|
end
|
|
32
22
|
end
|
|
33
|
-
v = {
|
|
34
|
-
firedSet = __TS__New(Set),
|
|
35
|
-
currentRoomIndex = nil,
|
|
36
|
-
currentRoomVisitedCount = nil
|
|
37
|
-
}}
|
|
23
|
+
v = {room = {firedSet = __TS__New(Set)}}
|
|
38
24
|
function ____exports.postEffectInitLateCallbackInit(self, mod)
|
|
39
25
|
saveDataManager(nil, "postEffectInitLate", v, hasSubscriptions)
|
|
40
26
|
mod:AddCallback(ModCallbacks.MC_POST_EFFECT_UPDATE, postEffectUpdate)
|
|
@@ -4,9 +4,6 @@ local ____exports = {}
|
|
|
4
4
|
local hasSubscriptions, postFamiliarUpdate, v
|
|
5
5
|
local ____exports = require("features.saveDataManager.exports")
|
|
6
6
|
local saveDataManager = ____exports.saveDataManager
|
|
7
|
-
local ____rooms = require("functions.rooms")
|
|
8
|
-
local getRoomIndex = ____rooms.getRoomIndex
|
|
9
|
-
local getRoomVisitedCount = ____rooms.getRoomVisitedCount
|
|
10
7
|
local ____postFamiliarInitLate = require("callbacks.subscriptions.postFamiliarInitLate")
|
|
11
8
|
local postFamiliarInitLateFire = ____postFamiliarInitLate.postFamiliarInitLateFire
|
|
12
9
|
local postFamiliarInitLateHasSubscriptions = ____postFamiliarInitLate.postFamiliarInitLateHasSubscriptions
|
|
@@ -17,24 +14,13 @@ function postFamiliarUpdate(self, familiar)
|
|
|
17
14
|
if not hasSubscriptions(nil) then
|
|
18
15
|
return
|
|
19
16
|
end
|
|
20
|
-
local roomIndex = getRoomIndex(nil)
|
|
21
|
-
local roomVisitedCount = getRoomVisitedCount(nil)
|
|
22
|
-
if roomIndex ~= v.run.currentRoomIndex or roomVisitedCount ~= v.run.currentRoomVisitedCount then
|
|
23
|
-
v.run.currentRoomIndex = roomIndex
|
|
24
|
-
v.run.currentRoomVisitedCount = roomVisitedCount
|
|
25
|
-
v.run.firedSet:clear()
|
|
26
|
-
end
|
|
27
17
|
local index = GetPtrHash(familiar)
|
|
28
18
|
if not v.run.firedSet:has(index) then
|
|
29
19
|
v.run.firedSet:add(index)
|
|
30
20
|
postFamiliarInitLateFire(nil, familiar)
|
|
31
21
|
end
|
|
32
22
|
end
|
|
33
|
-
v = {run = {
|
|
34
|
-
firedSet = __TS__New(Set),
|
|
35
|
-
currentRoomIndex = nil,
|
|
36
|
-
currentRoomVisitedCount = nil
|
|
37
|
-
}}
|
|
23
|
+
v = {run = {firedSet = __TS__New(Set)}}
|
|
38
24
|
function ____exports.postFamiliarInitLateCallbackInit(self, mod)
|
|
39
25
|
saveDataManager(nil, "postFamiliarInitLate", v, hasSubscriptions)
|
|
40
26
|
mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, postFamiliarUpdate)
|
|
@@ -4,9 +4,6 @@ local ____exports = {}
|
|
|
4
4
|
local hasSubscriptions, postKnifeUpdate, v
|
|
5
5
|
local ____exports = require("features.saveDataManager.exports")
|
|
6
6
|
local saveDataManager = ____exports.saveDataManager
|
|
7
|
-
local ____rooms = require("functions.rooms")
|
|
8
|
-
local getRoomIndex = ____rooms.getRoomIndex
|
|
9
|
-
local getRoomVisitedCount = ____rooms.getRoomVisitedCount
|
|
10
7
|
local ____postKnifeInitLate = require("callbacks.subscriptions.postKnifeInitLate")
|
|
11
8
|
local postKnifeInitLateFire = ____postKnifeInitLate.postKnifeInitLateFire
|
|
12
9
|
local postKnifeInitLateHasSubscriptions = ____postKnifeInitLate.postKnifeInitLateHasSubscriptions
|
|
@@ -17,24 +14,13 @@ function postKnifeUpdate(self, knife)
|
|
|
17
14
|
if not hasSubscriptions(nil) then
|
|
18
15
|
return
|
|
19
16
|
end
|
|
20
|
-
local roomIndex = getRoomIndex(nil)
|
|
21
|
-
local roomVisitedCount = getRoomVisitedCount(nil)
|
|
22
|
-
if roomIndex ~= v.run.currentRoomIndex or roomVisitedCount ~= v.run.currentRoomVisitedCount then
|
|
23
|
-
v.run.currentRoomIndex = roomIndex
|
|
24
|
-
v.run.currentRoomVisitedCount = roomVisitedCount
|
|
25
|
-
v.run.firedSet:clear()
|
|
26
|
-
end
|
|
27
17
|
local index = GetPtrHash(knife)
|
|
28
|
-
if not v.
|
|
29
|
-
v.
|
|
18
|
+
if not v.room.firedSet:has(index) then
|
|
19
|
+
v.room.firedSet:add(index)
|
|
30
20
|
postKnifeInitLateFire(nil, knife)
|
|
31
21
|
end
|
|
32
22
|
end
|
|
33
|
-
v = {
|
|
34
|
-
firedSet = __TS__New(Set),
|
|
35
|
-
currentRoomIndex = nil,
|
|
36
|
-
currentRoomVisitedCount = nil
|
|
37
|
-
}}
|
|
23
|
+
v = {room = {firedSet = __TS__New(Set)}}
|
|
38
24
|
function ____exports.postKnifeInitLateCallbackInit(self, mod)
|
|
39
25
|
saveDataManager(nil, "postKnifeInitLate", v, hasSubscriptions)
|
|
40
26
|
mod:AddCallback(ModCallbacks.MC_POST_KNIFE_UPDATE, postKnifeUpdate)
|
|
@@ -4,9 +4,6 @@ local ____exports = {}
|
|
|
4
4
|
local hasSubscriptions, postLaserUpdate, v
|
|
5
5
|
local ____exports = require("features.saveDataManager.exports")
|
|
6
6
|
local saveDataManager = ____exports.saveDataManager
|
|
7
|
-
local ____rooms = require("functions.rooms")
|
|
8
|
-
local getRoomIndex = ____rooms.getRoomIndex
|
|
9
|
-
local getRoomVisitedCount = ____rooms.getRoomVisitedCount
|
|
10
7
|
local ____postLaserInitLate = require("callbacks.subscriptions.postLaserInitLate")
|
|
11
8
|
local postLaserInitLateFire = ____postLaserInitLate.postLaserInitLateFire
|
|
12
9
|
local postLaserInitLateHasSubscriptions = ____postLaserInitLate.postLaserInitLateHasSubscriptions
|
|
@@ -17,24 +14,13 @@ function postLaserUpdate(self, laser)
|
|
|
17
14
|
if not hasSubscriptions(nil) then
|
|
18
15
|
return
|
|
19
16
|
end
|
|
20
|
-
local roomIndex = getRoomIndex(nil)
|
|
21
|
-
local roomVisitedCount = getRoomVisitedCount(nil)
|
|
22
|
-
if roomIndex ~= v.run.currentRoomIndex or roomVisitedCount ~= v.run.currentRoomVisitedCount then
|
|
23
|
-
v.run.currentRoomIndex = roomIndex
|
|
24
|
-
v.run.currentRoomVisitedCount = roomVisitedCount
|
|
25
|
-
v.run.firedSet:clear()
|
|
26
|
-
end
|
|
27
17
|
local index = GetPtrHash(laser)
|
|
28
|
-
if not v.
|
|
29
|
-
v.
|
|
18
|
+
if not v.room.firedSet:has(index) then
|
|
19
|
+
v.room.firedSet:add(index)
|
|
30
20
|
postLaserInitLateFire(nil, laser)
|
|
31
21
|
end
|
|
32
22
|
end
|
|
33
|
-
v = {
|
|
34
|
-
firedSet = __TS__New(Set),
|
|
35
|
-
currentRoomIndex = nil,
|
|
36
|
-
currentRoomVisitedCount = nil
|
|
37
|
-
}}
|
|
23
|
+
v = {room = {firedSet = __TS__New(Set)}}
|
|
38
24
|
function ____exports.postLaserInitLateCallbackInit(self, mod)
|
|
39
25
|
saveDataManager(nil, "postLaserInitLate", v, hasSubscriptions)
|
|
40
26
|
mod:AddCallback(ModCallbacks.MC_POST_LASER_UPDATE, postLaserUpdate)
|
|
@@ -4,9 +4,6 @@ local ____exports = {}
|
|
|
4
4
|
local hasSubscriptions, postNPCUpdate, v
|
|
5
5
|
local ____exports = require("features.saveDataManager.exports")
|
|
6
6
|
local saveDataManager = ____exports.saveDataManager
|
|
7
|
-
local ____rooms = require("functions.rooms")
|
|
8
|
-
local getRoomIndex = ____rooms.getRoomIndex
|
|
9
|
-
local getRoomVisitedCount = ____rooms.getRoomVisitedCount
|
|
10
7
|
local ____postNPCInitLate = require("callbacks.subscriptions.postNPCInitLate")
|
|
11
8
|
local postNPCInitLateFire = ____postNPCInitLate.postNPCInitLateFire
|
|
12
9
|
local postNPCInitLateHasSubscriptions = ____postNPCInitLate.postNPCInitLateHasSubscriptions
|
|
@@ -17,24 +14,13 @@ function postNPCUpdate(self, npc)
|
|
|
17
14
|
if not hasSubscriptions(nil) then
|
|
18
15
|
return
|
|
19
16
|
end
|
|
20
|
-
local roomIndex = getRoomIndex(nil)
|
|
21
|
-
local roomVisitedCount = getRoomVisitedCount(nil)
|
|
22
|
-
if roomIndex ~= v.run.currentRoomIndex or roomVisitedCount ~= v.run.currentRoomVisitedCount then
|
|
23
|
-
v.run.currentRoomIndex = roomIndex
|
|
24
|
-
v.run.currentRoomVisitedCount = roomVisitedCount
|
|
25
|
-
v.run.firedSet:clear()
|
|
26
|
-
end
|
|
27
17
|
local index = GetPtrHash(npc)
|
|
28
|
-
if not v.
|
|
29
|
-
v.
|
|
18
|
+
if not v.room.firedSet:has(index) then
|
|
19
|
+
v.room.firedSet:add(index)
|
|
30
20
|
postNPCInitLateFire(nil, npc)
|
|
31
21
|
end
|
|
32
22
|
end
|
|
33
|
-
v = {
|
|
34
|
-
firedSet = __TS__New(Set),
|
|
35
|
-
currentRoomIndex = nil,
|
|
36
|
-
currentRoomVisitedCount = nil
|
|
37
|
-
}}
|
|
23
|
+
v = {room = {firedSet = __TS__New(Set)}}
|
|
38
24
|
function ____exports.postNPCInitLateCallbackInit(self, mod)
|
|
39
25
|
saveDataManager(nil, "postNPCInitLate", v, hasSubscriptions)
|
|
40
26
|
mod:AddCallback(ModCallbacks.MC_NPC_UPDATE, postNPCUpdate)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local hasSubscriptions, postNewRoom, preEntitySpawn, checkRoomChanged, currentRoomTopLeftWallPtrHash
|
|
4
|
+
local ____gridEntity = require("functions.gridEntity")
|
|
5
|
+
local getTopLeftWallGridIndex = ____gridEntity.getTopLeftWallGridIndex
|
|
6
|
+
local spawnGridEntity = ____gridEntity.spawnGridEntity
|
|
7
|
+
local ____postNewRoomEarly = require("callbacks.subscriptions.postNewRoomEarly")
|
|
8
|
+
local postNewRoomEarlyFire = ____postNewRoomEarly.postNewRoomEarlyFire
|
|
9
|
+
local postNewRoomEarlyHasSubscriptions = ____postNewRoomEarly.postNewRoomEarlyHasSubscriptions
|
|
10
|
+
function hasSubscriptions(self)
|
|
11
|
+
return postNewRoomEarlyHasSubscriptions(nil)
|
|
12
|
+
end
|
|
13
|
+
function postNewRoom(self)
|
|
14
|
+
if not hasSubscriptions(nil) then
|
|
15
|
+
return
|
|
16
|
+
end
|
|
17
|
+
checkRoomChanged(nil)
|
|
18
|
+
end
|
|
19
|
+
function preEntitySpawn(self)
|
|
20
|
+
if not hasSubscriptions(nil) then
|
|
21
|
+
return
|
|
22
|
+
end
|
|
23
|
+
checkRoomChanged(nil)
|
|
24
|
+
end
|
|
25
|
+
function checkRoomChanged(self)
|
|
26
|
+
local game = Game()
|
|
27
|
+
local room = game:GetRoom()
|
|
28
|
+
local topLeftWallGridIndex = getTopLeftWallGridIndex(nil)
|
|
29
|
+
local topLeftWall = room:GetGridEntity(topLeftWallGridIndex)
|
|
30
|
+
if topLeftWall == nil then
|
|
31
|
+
topLeftWall = spawnGridEntity(nil, GridEntityType.GRID_WALL, topLeftWallGridIndex)
|
|
32
|
+
end
|
|
33
|
+
local ____temp_0
|
|
34
|
+
if topLeftWall == nil then
|
|
35
|
+
____temp_0 = nil
|
|
36
|
+
else
|
|
37
|
+
____temp_0 = GetPtrHash(topLeftWall)
|
|
38
|
+
end
|
|
39
|
+
local topLeftWallPtrHash = ____temp_0
|
|
40
|
+
if topLeftWallPtrHash ~= currentRoomTopLeftWallPtrHash then
|
|
41
|
+
currentRoomTopLeftWallPtrHash = topLeftWallPtrHash
|
|
42
|
+
postNewRoomEarlyFire(nil)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
currentRoomTopLeftWallPtrHash = nil
|
|
46
|
+
function ____exports.postNewRoomEarlyCallbackInit(self, mod)
|
|
47
|
+
mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, postNewRoom)
|
|
48
|
+
mod:AddCallback(ModCallbacks.MC_PRE_ENTITY_SPAWN, preEntitySpawn)
|
|
49
|
+
end
|
|
50
|
+
return ____exports
|
|
@@ -4,9 +4,6 @@ local ____exports = {}
|
|
|
4
4
|
local hasSubscriptions, postPickupUpdate, v
|
|
5
5
|
local ____exports = require("features.saveDataManager.exports")
|
|
6
6
|
local saveDataManager = ____exports.saveDataManager
|
|
7
|
-
local ____rooms = require("functions.rooms")
|
|
8
|
-
local getRoomIndex = ____rooms.getRoomIndex
|
|
9
|
-
local getRoomVisitedCount = ____rooms.getRoomVisitedCount
|
|
10
7
|
local ____postPickupInitLate = require("callbacks.subscriptions.postPickupInitLate")
|
|
11
8
|
local postPickupInitLateFire = ____postPickupInitLate.postPickupInitLateFire
|
|
12
9
|
local postPickupInitLateHasSubscriptions = ____postPickupInitLate.postPickupInitLateHasSubscriptions
|
|
@@ -17,24 +14,13 @@ function postPickupUpdate(self, pickup)
|
|
|
17
14
|
if not hasSubscriptions(nil) then
|
|
18
15
|
return
|
|
19
16
|
end
|
|
20
|
-
local roomIndex = getRoomIndex(nil)
|
|
21
|
-
local roomVisitedCount = getRoomVisitedCount(nil)
|
|
22
|
-
if roomIndex ~= v.run.currentRoomIndex or roomVisitedCount ~= v.run.currentRoomVisitedCount then
|
|
23
|
-
v.run.currentRoomIndex = roomIndex
|
|
24
|
-
v.run.currentRoomVisitedCount = roomVisitedCount
|
|
25
|
-
v.run.firedSet:clear()
|
|
26
|
-
end
|
|
27
17
|
local index = GetPtrHash(pickup)
|
|
28
|
-
if not v.
|
|
29
|
-
v.
|
|
18
|
+
if not v.room.firedSet:has(index) then
|
|
19
|
+
v.room.firedSet:add(index)
|
|
30
20
|
postPickupInitLateFire(nil, pickup)
|
|
31
21
|
end
|
|
32
22
|
end
|
|
33
|
-
v = {
|
|
34
|
-
firedSet = __TS__New(Set),
|
|
35
|
-
currentRoomIndex = nil,
|
|
36
|
-
currentRoomVisitedCount = nil
|
|
37
|
-
}}
|
|
23
|
+
v = {room = {firedSet = __TS__New(Set)}}
|
|
38
24
|
function ____exports.postPickupInitLateCallbackInit(self, mod)
|
|
39
25
|
saveDataManager(nil, "postPickupInitLate", v, hasSubscriptions)
|
|
40
26
|
mod:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, postPickupUpdate)
|
|
@@ -4,9 +4,6 @@ local ____exports = {}
|
|
|
4
4
|
local hasSubscriptions, postProjectileUpdate, v
|
|
5
5
|
local ____exports = require("features.saveDataManager.exports")
|
|
6
6
|
local saveDataManager = ____exports.saveDataManager
|
|
7
|
-
local ____rooms = require("functions.rooms")
|
|
8
|
-
local getRoomIndex = ____rooms.getRoomIndex
|
|
9
|
-
local getRoomVisitedCount = ____rooms.getRoomVisitedCount
|
|
10
7
|
local ____postProjectileInitLate = require("callbacks.subscriptions.postProjectileInitLate")
|
|
11
8
|
local postProjectileInitLateFire = ____postProjectileInitLate.postProjectileInitLateFire
|
|
12
9
|
local postProjectileInitLateHasSubscriptions = ____postProjectileInitLate.postProjectileInitLateHasSubscriptions
|
|
@@ -17,24 +14,13 @@ function postProjectileUpdate(self, projectile)
|
|
|
17
14
|
if not hasSubscriptions(nil) then
|
|
18
15
|
return
|
|
19
16
|
end
|
|
20
|
-
local roomIndex = getRoomIndex(nil)
|
|
21
|
-
local roomVisitedCount = getRoomVisitedCount(nil)
|
|
22
|
-
if roomIndex ~= v.run.currentRoomIndex or roomVisitedCount ~= v.run.currentRoomVisitedCount then
|
|
23
|
-
v.run.currentRoomIndex = roomIndex
|
|
24
|
-
v.run.currentRoomVisitedCount = roomVisitedCount
|
|
25
|
-
v.run.firedSet:clear()
|
|
26
|
-
end
|
|
27
17
|
local index = GetPtrHash(projectile)
|
|
28
|
-
if not v.
|
|
29
|
-
v.
|
|
18
|
+
if not v.room.firedSet:has(index) then
|
|
19
|
+
v.room.firedSet:add(index)
|
|
30
20
|
postProjectileInitLateFire(nil, projectile)
|
|
31
21
|
end
|
|
32
22
|
end
|
|
33
|
-
v = {
|
|
34
|
-
firedSet = __TS__New(Set),
|
|
35
|
-
currentRoomIndex = nil,
|
|
36
|
-
currentRoomVisitedCount = nil
|
|
37
|
-
}}
|
|
23
|
+
v = {room = {firedSet = __TS__New(Set)}}
|
|
38
24
|
function ____exports.postProjectileInitLateCallbackInit(self, mod)
|
|
39
25
|
saveDataManager(nil, "postProjectileInitLate", v, hasSubscriptions)
|
|
40
26
|
mod:AddCallback(ModCallbacks.MC_POST_PROJECTILE_UPDATE, postProjectileUpdate)
|
|
@@ -4,9 +4,6 @@ local ____exports = {}
|
|
|
4
4
|
local hasSubscriptions, postTearUpdate, v
|
|
5
5
|
local ____exports = require("features.saveDataManager.exports")
|
|
6
6
|
local saveDataManager = ____exports.saveDataManager
|
|
7
|
-
local ____rooms = require("functions.rooms")
|
|
8
|
-
local getRoomIndex = ____rooms.getRoomIndex
|
|
9
|
-
local getRoomVisitedCount = ____rooms.getRoomVisitedCount
|
|
10
7
|
local ____postTearInitLate = require("callbacks.subscriptions.postTearInitLate")
|
|
11
8
|
local postTearInitLateFire = ____postTearInitLate.postTearInitLateFire
|
|
12
9
|
local postTearInitLateHasSubscriptions = ____postTearInitLate.postTearInitLateHasSubscriptions
|
|
@@ -17,24 +14,13 @@ function postTearUpdate(self, tear)
|
|
|
17
14
|
if not hasSubscriptions(nil) then
|
|
18
15
|
return
|
|
19
16
|
end
|
|
20
|
-
local roomIndex = getRoomIndex(nil)
|
|
21
|
-
local roomVisitedCount = getRoomVisitedCount(nil)
|
|
22
|
-
if roomIndex ~= v.run.currentRoomIndex or roomVisitedCount ~= v.run.currentRoomVisitedCount then
|
|
23
|
-
v.run.currentRoomIndex = roomIndex
|
|
24
|
-
v.run.currentRoomVisitedCount = roomVisitedCount
|
|
25
|
-
v.run.firedSet:clear()
|
|
26
|
-
end
|
|
27
17
|
local index = GetPtrHash(tear)
|
|
28
|
-
if not v.
|
|
29
|
-
v.
|
|
18
|
+
if not v.room.firedSet:has(index) then
|
|
19
|
+
v.room.firedSet:add(index)
|
|
30
20
|
postTearInitLateFire(nil, tear)
|
|
31
21
|
end
|
|
32
22
|
end
|
|
33
|
-
v = {
|
|
34
|
-
firedSet = __TS__New(Set),
|
|
35
|
-
currentRoomIndex = nil,
|
|
36
|
-
currentRoomVisitedCount = nil
|
|
37
|
-
}}
|
|
23
|
+
v = {room = {firedSet = __TS__New(Set)}}
|
|
38
24
|
function ____exports.postTearInitLateCallbackInit(self, mod)
|
|
39
25
|
saveDataManager(nil, "postTearInitLate", v, hasSubscriptions)
|
|
40
26
|
mod:AddCallback(ModCallbacks.MC_POST_TEAR_UPDATE, postTearUpdate)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare type PostNewRoomEarlyCallbackType = () => void;
|
|
2
|
+
export declare function postNewRoomEarlyHasSubscriptions(): boolean;
|
|
3
|
+
export declare function postNewRoomEarlyRegister(callback: PostNewRoomEarlyCallbackType): void;
|
|
4
|
+
export declare function postNewRoomEarlyFire(): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
require("lualib_bundle");
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local subscriptions = {}
|
|
5
|
+
function ____exports.postNewRoomEarlyHasSubscriptions(self)
|
|
6
|
+
return #subscriptions > 0
|
|
7
|
+
end
|
|
8
|
+
function ____exports.postNewRoomEarlyRegister(self, callback)
|
|
9
|
+
__TS__ArrayPush(subscriptions, {callback})
|
|
10
|
+
end
|
|
11
|
+
function ____exports.postNewRoomEarlyFire(self)
|
|
12
|
+
local callback
|
|
13
|
+
for ____, ____value in ipairs(subscriptions) do
|
|
14
|
+
callback = ____value[1]
|
|
15
|
+
callback(nil)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
return ____exports
|
|
@@ -22,7 +22,7 @@ local getNPCs = ____npc.getNPCs
|
|
|
22
22
|
local ____random = require("functions.random")
|
|
23
23
|
local nextSeed = ____random.nextSeed
|
|
24
24
|
local ____rooms = require("functions.rooms")
|
|
25
|
-
local
|
|
25
|
+
local getRoomListIndex = ____rooms.getRoomListIndex
|
|
26
26
|
local gridToPos = ____rooms.gridToPos
|
|
27
27
|
local setRoomCleared = ____rooms.setRoomCleared
|
|
28
28
|
local setRoomUncleared = ____rooms.setRoomUncleared
|
|
@@ -31,8 +31,8 @@ local spawnCollectible = ____spawnCollectible.spawnCollectible
|
|
|
31
31
|
local ____exports = require("features.saveDataManager.exports")
|
|
32
32
|
local saveDataManager = ____exports.saveDataManager
|
|
33
33
|
function postNewRoom(self)
|
|
34
|
-
local
|
|
35
|
-
if not v.level.
|
|
34
|
+
local roomListIndex = getRoomListIndex(nil)
|
|
35
|
+
if not v.level.deployedRoomListIndexes:has(roomListIndex) then
|
|
36
36
|
return
|
|
37
37
|
end
|
|
38
38
|
setDecorationsInvisible(nil)
|
|
@@ -41,8 +41,8 @@ end
|
|
|
41
41
|
function setDecorationsInvisible(self)
|
|
42
42
|
local game = Game()
|
|
43
43
|
local room = game:GetRoom()
|
|
44
|
-
local
|
|
45
|
-
local decorationGridIndexes = v.level.decorationGridIndexes:get(
|
|
44
|
+
local roomListIndex = getRoomListIndex(nil)
|
|
45
|
+
local decorationGridIndexes = v.level.decorationGridIndexes:get(roomListIndex)
|
|
46
46
|
if decorationGridIndexes == nil then
|
|
47
47
|
return
|
|
48
48
|
end
|
|
@@ -56,8 +56,8 @@ end
|
|
|
56
56
|
function respawnPersistentEntities(self)
|
|
57
57
|
local game = Game()
|
|
58
58
|
local room = game:GetRoom()
|
|
59
|
-
local
|
|
60
|
-
local persistentEntities = v.level.persistentEntities:get(
|
|
59
|
+
local roomListIndex = getRoomListIndex(nil)
|
|
60
|
+
local persistentEntities = v.level.persistentEntities:get(roomListIndex)
|
|
61
61
|
if persistentEntities == nil then
|
|
62
62
|
return
|
|
63
63
|
end
|
|
@@ -78,8 +78,8 @@ function ____exports.emptyRoom(self, fillWithDecorations)
|
|
|
78
78
|
local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
|
|
79
79
|
error(msg)
|
|
80
80
|
end
|
|
81
|
-
local
|
|
82
|
-
v.level.
|
|
81
|
+
local roomListIndex = getRoomListIndex(nil)
|
|
82
|
+
v.level.deployedRoomListIndexes:add(roomListIndex)
|
|
83
83
|
removeAllBombs(nil)
|
|
84
84
|
removeAllPickups(nil)
|
|
85
85
|
removeAllMatchingEntities(nil, EntityType.ENTITY_SLOT)
|
|
@@ -117,11 +117,11 @@ function fillRoomWithDecorations(self)
|
|
|
117
117
|
local game = Game()
|
|
118
118
|
local room = game:GetRoom()
|
|
119
119
|
local gridSize = room:GetGridSize()
|
|
120
|
-
local
|
|
121
|
-
local decorationGridIndexes = v.level.decorationGridIndexes:get(
|
|
120
|
+
local roomListIndex = getRoomListIndex(nil)
|
|
121
|
+
local decorationGridIndexes = v.level.decorationGridIndexes:get(roomListIndex)
|
|
122
122
|
if decorationGridIndexes == nil then
|
|
123
123
|
decorationGridIndexes = {}
|
|
124
|
-
v.level.decorationGridIndexes:set(
|
|
124
|
+
v.level.decorationGridIndexes:set(roomListIndex, decorationGridIndexes)
|
|
125
125
|
end
|
|
126
126
|
do
|
|
127
127
|
local gridIndex = 0
|
|
@@ -278,12 +278,12 @@ function storePersistentEntity(self, entity)
|
|
|
278
278
|
local game = Game()
|
|
279
279
|
local room = game:GetRoom()
|
|
280
280
|
local gridIndex = room:GetGridIndex(entity.Position)
|
|
281
|
-
local
|
|
281
|
+
local roomListIndex = getRoomListIndex(nil)
|
|
282
282
|
local persistentEntity = {gridIndex = gridIndex, type = entity.Type, variant = entity.Variant, subType = entity.SubType}
|
|
283
|
-
local persistentEntities = v.level.persistentEntities:get(
|
|
283
|
+
local persistentEntities = v.level.persistentEntities:get(roomListIndex)
|
|
284
284
|
if persistentEntities == nil then
|
|
285
285
|
persistentEntities = {}
|
|
286
|
-
v.level.persistentEntities:set(
|
|
286
|
+
v.level.persistentEntities:set(roomListIndex, persistentEntities)
|
|
287
287
|
end
|
|
288
288
|
__TS__ArrayPush(persistentEntities, persistentEntity)
|
|
289
289
|
end
|
|
@@ -405,7 +405,7 @@ NPC_TYPES_TO_NOT_REMOVE = __TS__New(Set, {EntityType.ENTITY_DARK_ESAU})
|
|
|
405
405
|
PERSISTENT_ENTITY_TYPES = __TS__New(Set, {EntityType.ENTITY_WALL_HUGGER})
|
|
406
406
|
initialized = false
|
|
407
407
|
v = {level = {
|
|
408
|
-
|
|
408
|
+
deployedRoomListIndexes = __TS__New(Set),
|
|
409
409
|
persistentEntities = __TS__New(Map),
|
|
410
410
|
decorationGridIndexes = __TS__New(Map)
|
|
411
411
|
}}
|
|
@@ -17,12 +17,7 @@ function postPickupInitCollectible(self, pickup)
|
|
|
17
17
|
end
|
|
18
18
|
local FEATURE_NAME = "get collectible item pool type"
|
|
19
19
|
local initialized = false
|
|
20
|
-
v = {run = {
|
|
21
|
-
collectibleQueue = {},
|
|
22
|
-
collectibleItemPoolTypeMap = __TS__New(Map),
|
|
23
|
-
currentRoomIndex = nil,
|
|
24
|
-
currentRoomVisitedCount = nil
|
|
25
|
-
}}
|
|
20
|
+
v = {run = {collectibleItemPoolTypeMap = __TS__New(Map)}}
|
|
26
21
|
function ____exports.getCollectibleItemPoolTypeInit(self, mod)
|
|
27
22
|
initialized = true
|
|
28
23
|
saveDataManager(nil, "getCollectibleItemPoolType", v)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local postPlayerInit, preGameExit, postNewLevel,
|
|
3
|
+
local postPlayerInit, preGameExit, postNewLevel, postNewRoomEarly, restoreDefaultsAll, restoreDefaults, clearAndCopyAllElements, mod, loadedDataOnThisRun
|
|
4
4
|
local ____errors = require("errors")
|
|
5
5
|
local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
|
|
6
6
|
local ____deepCopy = require("functions.deepCopy")
|
|
@@ -8,6 +8,8 @@ local deepCopy = ____deepCopy.deepCopy
|
|
|
8
8
|
local SerializationType = ____deepCopy.SerializationType
|
|
9
9
|
local ____util = require("functions.util")
|
|
10
10
|
local tableClear = ____util.tableClear
|
|
11
|
+
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
12
|
+
local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
|
|
11
13
|
local ____SaveData = require("types.SaveData")
|
|
12
14
|
local SaveDataKeys = ____SaveData.SaveDataKeys
|
|
13
15
|
local ____load = require("features.saveDataManager.load")
|
|
@@ -47,7 +49,7 @@ end
|
|
|
47
49
|
function postNewLevel(self)
|
|
48
50
|
restoreDefaults(nil, SaveDataKeys.Level)
|
|
49
51
|
end
|
|
50
|
-
function
|
|
52
|
+
function postNewRoomEarly(self)
|
|
51
53
|
restoreDefaults(nil, SaveDataKeys.Room)
|
|
52
54
|
end
|
|
53
55
|
function restoreDefaultsAll(self)
|
|
@@ -94,7 +96,7 @@ function ____exports.saveDataManagerInit(self, incomingMod)
|
|
|
94
96
|
mod:AddCallback(ModCallbacks.MC_POST_PLAYER_INIT, postPlayerInit)
|
|
95
97
|
mod:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, preGameExit)
|
|
96
98
|
mod:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, postNewLevel)
|
|
97
|
-
mod:
|
|
99
|
+
mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_NEW_ROOM_EARLY, postNewRoomEarly)
|
|
98
100
|
end
|
|
99
101
|
function ____exports.isSaveDataManagerInitialized(self)
|
|
100
102
|
return mod ~= nil
|
|
@@ -57,9 +57,9 @@ export declare function isGlitchedCollectible(entity: Entity): boolean;
|
|
|
57
57
|
export declare function isPassiveCollectible(collectibleType: CollectibleType | int): boolean;
|
|
58
58
|
export declare function isQuestCollectible(collectibleType: CollectibleType | int): boolean;
|
|
59
59
|
/**
|
|
60
|
-
* Helper function to
|
|
61
|
-
* upon use. Note that this will not work will modded items, as there is no way to
|
|
62
|
-
* if a modded item will disappear.
|
|
60
|
+
* Helper function to determine if a particular collectible will disappear from the player's
|
|
61
|
+
* inventory upon use. Note that this will not work will modded items, as there is no way to
|
|
62
|
+
* dynamically know if a modded item will disappear.
|
|
63
63
|
*/
|
|
64
64
|
export declare function isSingleUseCollectible(collectibleType: CollectibleType | int): boolean;
|
|
65
65
|
/**
|
|
@@ -89,14 +89,14 @@ export declare function setCollectibleBlind(collectible: EntityPickup): void;
|
|
|
89
89
|
* player has already taken the item. This is accomplished by setting its sprite to an empty/missing
|
|
90
90
|
* PNG file.
|
|
91
91
|
*
|
|
92
|
-
* For more information, see the documentation for the "
|
|
92
|
+
* For more information, see the documentation for the "emptySprite" helper function.
|
|
93
93
|
*/
|
|
94
94
|
export declare function setCollectibleEmpty(collectible: EntityPickup): void;
|
|
95
95
|
/**
|
|
96
96
|
* Helper function to change the sprite of a collectible pedestal entity.
|
|
97
97
|
*
|
|
98
98
|
* For more information about removing the collectible sprite, see the documentation for the
|
|
99
|
-
* "
|
|
99
|
+
* "emptySprite" helper function.
|
|
100
100
|
*
|
|
101
101
|
* @param collectible The collectible whose sprite you want to modify.
|
|
102
102
|
* @param pngPath Optional. Equal to the spritesheet path to load (e.g.
|
|
@@ -178,6 +178,10 @@ function ____exports.setCollectibleSubType(self, collectible, newCollectibleType
|
|
|
178
178
|
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
179
179
|
error("You cannot set a collectible sub type for pickups of variant: " .. tostring(collectible.Variant))
|
|
180
180
|
end
|
|
181
|
+
if newCollectibleType == CollectibleType.COLLECTIBLE_NULL then
|
|
182
|
+
____exports.setCollectibleEmpty(nil, collectible)
|
|
183
|
+
return
|
|
184
|
+
end
|
|
181
185
|
collectible:Morph(
|
|
182
186
|
EntityType.ENTITY_PICKUP,
|
|
183
187
|
PickupVariant.PICKUP_COLLECTIBLE,
|
package/dist/functions/flag.d.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function addFlag(flags: int, ...flag: int[]): int;
|
|
25
25
|
/**
|
|
26
|
-
* Helper function to
|
|
26
|
+
* Helper function to determine if a particular bit flag is set to true.
|
|
27
27
|
* This is a variadic function, so pass as many flags as you want to check for.
|
|
28
28
|
* If passed multiple flags, it will only return true if all of the flags are set.
|
|
29
29
|
*
|
|
@@ -26,10 +26,16 @@ export declare function convertXMLGridEntityType(gridEntityXMLType: int, gridEnt
|
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
export declare function getGridEntities(...gridEntityTypes: GridEntityType[]): GridEntity[];
|
|
29
|
+
export declare function getTopLeftWall(): GridEntity | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Helper function to get the grid index of the top left wall.
|
|
32
|
+
* (This will depend on what the current room shape is.)
|
|
33
|
+
*/
|
|
34
|
+
export declare function getTopLeftWallGridIndex(): int;
|
|
29
35
|
export declare function getSurroundingGridEntities(gridEntity: GridEntity): GridEntity[];
|
|
30
36
|
/**
|
|
31
|
-
* Helper function to
|
|
32
|
-
* if there are no pressure plates in the room.
|
|
37
|
+
* Helper function to determine if all of the pressure plates in the current room are pushed.
|
|
38
|
+
* Returns true if there are no pressure plates in the room.
|
|
33
39
|
*/
|
|
34
40
|
export declare function isAllPressurePlatesPushed(): boolean;
|
|
35
41
|
/**
|