isaacscript-common 1.2.153 → 1.2.154
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.
|
@@ -4,14 +4,17 @@ local Set = ____lualib.Set
|
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local Map = ____lualib.Map
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
local hasSubscriptions, postEffectRenderCustomEntity, getPositionOffset, getAnimation, POSITION_OFFSET_MULTIPLIER
|
|
7
|
+
local hasSubscriptions, postEffectRenderCustomEntity, isPlayerPastDoorThreshold, getPositionOffset, getAnimation, POSITION_OFFSET_MULTIPLIER, v
|
|
8
8
|
local ____cachedClasses = require("cachedClasses")
|
|
9
9
|
local game = ____cachedClasses.game
|
|
10
10
|
local ____exports = require("features.saveDataManager.exports")
|
|
11
11
|
local saveDataManager = ____exports.saveDataManager
|
|
12
12
|
local ____doors = require("functions.doors")
|
|
13
13
|
local doorSlotToDirection = ____doors.doorSlotToDirection
|
|
14
|
-
local
|
|
14
|
+
local ____player = require("functions.player")
|
|
15
|
+
local getClosestPlayer = ____player.getClosestPlayer
|
|
16
|
+
local ____utils = require("functions.utils")
|
|
17
|
+
local ensureAllCases = ____utils.ensureAllCases
|
|
15
18
|
local ____vector = require("functions.vector")
|
|
16
19
|
local directionToVector = ____vector.directionToVector
|
|
17
20
|
local ____postCustomDoorEnter = require("callbacks.subscriptions.postCustomDoorEnter")
|
|
@@ -20,16 +23,66 @@ local postCustomDoorEnterHasSubscriptions = ____postCustomDoorEnter.postCustomDo
|
|
|
20
23
|
function hasSubscriptions(self)
|
|
21
24
|
return postCustomDoorEnterHasSubscriptions(nil)
|
|
22
25
|
end
|
|
23
|
-
function postEffectRenderCustomEntity(self)
|
|
26
|
+
function postEffectRenderCustomEntity(self, effect)
|
|
24
27
|
if not hasSubscriptions(nil) then
|
|
25
28
|
return
|
|
26
29
|
end
|
|
27
|
-
local
|
|
28
|
-
|
|
30
|
+
local ptrHash = GetPtrHash(effect)
|
|
31
|
+
local doorData = v.room.doors:get(ptrHash)
|
|
32
|
+
if doorData == nil then
|
|
29
33
|
return
|
|
30
34
|
end
|
|
31
|
-
local
|
|
32
|
-
|
|
35
|
+
local direction = doorSlotToDirection(nil, doorData.slot)
|
|
36
|
+
local player = getClosestPlayer(nil, effect.Position)
|
|
37
|
+
if isPlayerPastDoorThreshold(nil, effect, player, direction) then
|
|
38
|
+
postCustomDoorEnterFire(
|
|
39
|
+
nil,
|
|
40
|
+
player,
|
|
41
|
+
effect.Variant,
|
|
42
|
+
doorData.slot,
|
|
43
|
+
direction
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
function isPlayerPastDoorThreshold(self, effect, player, direction)
|
|
48
|
+
repeat
|
|
49
|
+
local ____switch10 = direction
|
|
50
|
+
local ____cond10 = ____switch10 == Direction.NO_DIRECTION
|
|
51
|
+
if ____cond10 then
|
|
52
|
+
do
|
|
53
|
+
return false
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
____cond10 = ____cond10 or ____switch10 == Direction.UP
|
|
57
|
+
if ____cond10 then
|
|
58
|
+
do
|
|
59
|
+
return player.Position.Y <= effect.Position.Y
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
____cond10 = ____cond10 or ____switch10 == Direction.RIGHT
|
|
63
|
+
if ____cond10 then
|
|
64
|
+
do
|
|
65
|
+
return player.Position.X >= effect.Position.X
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
____cond10 = ____cond10 or ____switch10 == Direction.DOWN
|
|
69
|
+
if ____cond10 then
|
|
70
|
+
do
|
|
71
|
+
return player.Position.Y >= effect.Position.Y
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
____cond10 = ____cond10 or ____switch10 == Direction.LEFT
|
|
75
|
+
if ____cond10 then
|
|
76
|
+
do
|
|
77
|
+
return player.Position.X <= effect.Position.X
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
do
|
|
81
|
+
do
|
|
82
|
+
return ensureAllCases(nil, direction)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
until true
|
|
33
86
|
end
|
|
34
87
|
function getPositionOffset(self, doorSlot)
|
|
35
88
|
local direction = doorSlotToDirection(nil, doorSlot)
|
|
@@ -38,15 +91,15 @@ function getPositionOffset(self, doorSlot)
|
|
|
38
91
|
end
|
|
39
92
|
function getAnimation(self, effect)
|
|
40
93
|
repeat
|
|
41
|
-
local
|
|
42
|
-
local
|
|
43
|
-
if
|
|
94
|
+
local ____switch24 = effect.State
|
|
95
|
+
local ____cond24 = ____switch24 == DoorState.STATE_OPEN
|
|
96
|
+
if ____cond24 then
|
|
44
97
|
do
|
|
45
98
|
return "Opened"
|
|
46
99
|
end
|
|
47
100
|
end
|
|
48
|
-
|
|
49
|
-
if
|
|
101
|
+
____cond24 = ____cond24 or ____switch24 == DoorState.STATE_CLOSED
|
|
102
|
+
if ____cond24 then
|
|
50
103
|
do
|
|
51
104
|
return "Closed"
|
|
52
105
|
end
|
|
@@ -60,7 +113,7 @@ function getAnimation(self, effect)
|
|
|
60
113
|
end
|
|
61
114
|
POSITION_OFFSET_MULTIPLIER = 23
|
|
62
115
|
local initializedEffectVariants = __TS__New(Set)
|
|
63
|
-
|
|
116
|
+
v = {room = {doors = __TS__New(Map)}}
|
|
64
117
|
function ____exports.postCustomDoorEnterCallbackInit(self)
|
|
65
118
|
saveDataManager(nil, "postCustomDoorEnter", v, hasSubscriptions)
|
|
66
119
|
end
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
export declare type PostCustomDoorEnterCallbackType = (
|
|
2
|
+
export declare type PostCustomDoorEnterCallbackType = (player: EntityPlayer, effectVariant: int, doorSlot: DoorSlot, direction: Direction) => void;
|
|
@@ -6,18 +6,24 @@ local subscriptions = {}
|
|
|
6
6
|
function ____exports.postCustomDoorEnterHasSubscriptions(self)
|
|
7
7
|
return #subscriptions > 0
|
|
8
8
|
end
|
|
9
|
-
function ____exports.postCustomDoorEnterRegister(self, callback,
|
|
10
|
-
__TS__ArrayPush(subscriptions, {callback,
|
|
9
|
+
function ____exports.postCustomDoorEnterRegister(self, callback, effectVariant)
|
|
10
|
+
__TS__ArrayPush(subscriptions, {callback, effectVariant})
|
|
11
11
|
end
|
|
12
|
-
function ____exports.postCustomDoorEnterFire(self,
|
|
12
|
+
function ____exports.postCustomDoorEnterFire(self, player, effectVariant, doorSlot, direction)
|
|
13
13
|
for ____, ____value in ipairs(subscriptions) do
|
|
14
14
|
local callback = ____value[1]
|
|
15
|
-
local
|
|
15
|
+
local callbackEffectVariant = ____value[2]
|
|
16
16
|
do
|
|
17
|
-
if
|
|
17
|
+
if effectVariant ~= callbackEffectVariant then
|
|
18
18
|
goto __continue5
|
|
19
19
|
end
|
|
20
|
-
callback(
|
|
20
|
+
callback(
|
|
21
|
+
nil,
|
|
22
|
+
player,
|
|
23
|
+
effectVariant,
|
|
24
|
+
doorSlot,
|
|
25
|
+
direction
|
|
26
|
+
)
|
|
21
27
|
end
|
|
22
28
|
::__continue5::
|
|
23
29
|
end
|
|
@@ -3,8 +3,8 @@ local ____exports = {}
|
|
|
3
3
|
____exports.DIRECTION_TO_VECTOR = {
|
|
4
4
|
[Direction.NO_DIRECTION] = Vector.Zero,
|
|
5
5
|
[Direction.LEFT] = Vector(-1, 0),
|
|
6
|
-
[Direction.UP] = Vector(0,
|
|
6
|
+
[Direction.UP] = Vector(0, 1),
|
|
7
7
|
[Direction.RIGHT] = Vector(1, 0),
|
|
8
|
-
[Direction.DOWN] = Vector(0, 1)
|
|
8
|
+
[Direction.DOWN] = Vector(0, -1)
|
|
9
9
|
}
|
|
10
10
|
return ____exports
|