@rbxts/planck 0.2.5 → 0.3.0-alpha.2
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/package.json +40 -51
- package/{out → src}/DependencyGraph.luau +220 -180
- package/src/Phase.d.ts +23 -0
- package/{out → src}/Phase.luau +41 -41
- package/src/Pipeline.d.ts +26 -0
- package/{out → src}/Pipeline.luau +86 -86
- package/src/Scheduler.d.ts +385 -0
- package/{out → src}/Scheduler.luau +207 -44
- package/src/__tests__/InitializerSystems.test.luau +660 -0
- package/src/__tests__/Scheduler.test.luau +313 -0
- package/src/__tests__/conditions.test.luau +147 -0
- package/src/__tests__/hooks.test.luau +54 -0
- package/src/__tests__/systems.test.luau +192 -0
- package/src/conditions.d.ts +69 -0
- package/{out → src}/conditions.luau +189 -151
- package/{out → src}/hooks.luau +163 -145
- package/src/index.d.ts +12 -0
- package/src/init.luau +207 -0
- package/src/utils.d.ts +10 -0
- package/{out → src}/utils.luau +197 -161
- package/out/Phase.d.ts +0 -8
- package/out/Pipeline.d.ts +0 -11
- package/out/Scheduler.d.ts +0 -31
- package/out/conditions.d.ts +0 -14
- package/out/hooks.d.ts +0 -4
- package/out/index.d.ts +0 -18
- package/out/init.luau +0 -143
- package/out/types.d.ts +0 -113
- package/out/utils.d.ts +0 -4
package/{out → src}/hooks.luau
RENAMED
|
@@ -1,145 +1,163 @@
|
|
|
1
|
-
-- Super-duper experimental Plugin Hooks API
|
|
2
|
-
|
|
3
|
-
local function systemAdd(scheduler, systemInfo)
|
|
4
|
-
local hooks = scheduler._hooks[scheduler.Hooks.SystemAdd]
|
|
5
|
-
local info = {
|
|
6
|
-
scheduler = scheduler,
|
|
7
|
-
system = systemInfo,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
for _, hook in hooks do
|
|
11
|
-
local success, err = pcall(hook, info)
|
|
12
|
-
if not success then
|
|
13
|
-
warn("Unexpected error in hook:", err)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
local function systemRemove(scheduler, systemInfo)
|
|
19
|
-
local hooks = scheduler._hooks[scheduler.Hooks.SystemRemove]
|
|
20
|
-
local info = {
|
|
21
|
-
scheduler = scheduler,
|
|
22
|
-
system = systemInfo,
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
for _, hook in hooks do
|
|
26
|
-
local success, err = pcall(hook, info)
|
|
27
|
-
if not success then
|
|
28
|
-
warn("Unexpected error in hook:", err)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
local function
|
|
34
|
-
local hooks = scheduler._hooks[scheduler.Hooks.
|
|
35
|
-
local info = {
|
|
36
|
-
scheduler = scheduler,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
for _, hook in hooks do
|
|
42
|
-
local success, err = pcall(hook, info)
|
|
43
|
-
if not success then
|
|
44
|
-
warn("Unexpected error in hook:", err)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
local function
|
|
50
|
-
local hooks = scheduler._hooks[scheduler.Hooks
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
local
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
1
|
+
-- Super-duper experimental Plugin Hooks API
|
|
2
|
+
|
|
3
|
+
local function systemAdd(scheduler, systemInfo)
|
|
4
|
+
local hooks = scheduler._hooks[scheduler.Hooks.SystemAdd]
|
|
5
|
+
local info = {
|
|
6
|
+
scheduler = scheduler,
|
|
7
|
+
system = systemInfo,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
for _, hook in hooks do
|
|
11
|
+
local success, err = pcall(hook, info)
|
|
12
|
+
if not success then
|
|
13
|
+
warn("Unexpected error in hook:", err)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
local function systemRemove(scheduler, systemInfo)
|
|
19
|
+
local hooks = scheduler._hooks[scheduler.Hooks.SystemRemove]
|
|
20
|
+
local info = {
|
|
21
|
+
scheduler = scheduler,
|
|
22
|
+
system = systemInfo,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
for _, hook in hooks do
|
|
26
|
+
local success, err = pcall(hook, info)
|
|
27
|
+
if not success then
|
|
28
|
+
warn("Unexpected error in hook:", err)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
local function systemCleanup(scheduler, systemInfo, cleanupError)
|
|
34
|
+
local hooks = scheduler._hooks[scheduler.Hooks.SystemCleanup]
|
|
35
|
+
local info = {
|
|
36
|
+
scheduler = scheduler,
|
|
37
|
+
system = systemInfo,
|
|
38
|
+
error = cleanupError,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
for _, hook in hooks do
|
|
42
|
+
local success, err = pcall(hook, info)
|
|
43
|
+
if not success then
|
|
44
|
+
warn("Unexpected error in hook:", err)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
local function systemReplace(scheduler, oldSystemInfo, newSystemInfo)
|
|
50
|
+
local hooks = scheduler._hooks[scheduler.Hooks.SystemReplace]
|
|
51
|
+
local info = {
|
|
52
|
+
scheduler = scheduler,
|
|
53
|
+
new = newSystemInfo,
|
|
54
|
+
old = oldSystemInfo,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
for _, hook in hooks do
|
|
58
|
+
local success, err = pcall(hook, info)
|
|
59
|
+
if not success then
|
|
60
|
+
warn("Unexpected error in hook:", err)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
local function systemCall(scheduler, hookName, systemInfo, nextFn)
|
|
66
|
+
local hooks = scheduler._hooks[scheduler.Hooks[hookName]]
|
|
67
|
+
|
|
68
|
+
if hooks then
|
|
69
|
+
for _, hook in hooks do
|
|
70
|
+
nextFn = hook({
|
|
71
|
+
scheduler = nil,
|
|
72
|
+
system = systemInfo,
|
|
73
|
+
nextFn = nextFn,
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
if not nextFn then
|
|
77
|
+
local source, line = debug.info(hook, "sl")
|
|
78
|
+
warn(
|
|
79
|
+
`{source}:{line}: Expected 'SystemCall' hook to return a function`
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
nextFn()
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
local function systemError(scheduler, systemInfo, err)
|
|
89
|
+
local hooks = scheduler._hooks[scheduler.Hooks["SystemError"]]
|
|
90
|
+
|
|
91
|
+
if hooks then
|
|
92
|
+
for _, hook in hooks do
|
|
93
|
+
hook({
|
|
94
|
+
scheduler = scheduler,
|
|
95
|
+
system = systemInfo,
|
|
96
|
+
error = err,
|
|
97
|
+
})
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
type PhaseAdd = {
|
|
103
|
+
scheduler: any,
|
|
104
|
+
phase: any,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
local function phaseAdd(scheduler, phase)
|
|
108
|
+
local hooks = scheduler._hooks[scheduler.Hooks.PhaseAdd]
|
|
109
|
+
local info = {
|
|
110
|
+
scheduler = scheduler,
|
|
111
|
+
phase = phase,
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
for _, hook in hooks do
|
|
115
|
+
local success, err = pcall(hook, info)
|
|
116
|
+
if not success then
|
|
117
|
+
warn("Unexpected error in hook:", err)
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
local function phaseBegan(scheduler, phase)
|
|
123
|
+
local hooks = scheduler._hooks[scheduler.Hooks.PhaseBegan]
|
|
124
|
+
local info = {
|
|
125
|
+
scheduler = scheduler,
|
|
126
|
+
phase = phase,
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
for _, hook in hooks do
|
|
130
|
+
local success, err = pcall(hook, info)
|
|
131
|
+
if not success then
|
|
132
|
+
warn("Unexpected error in hook:", err)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
local Hooks = {
|
|
138
|
+
SystemAdd = "SystemAdd",
|
|
139
|
+
SystemRemove = "SystemRemove",
|
|
140
|
+
SystemReplace = "SystemReplace",
|
|
141
|
+
SystemCleanup = "SystemCleanup",
|
|
142
|
+
SystemError = "SystemError",
|
|
143
|
+
|
|
144
|
+
OuterSystemCall = "OuterSystemCall",
|
|
145
|
+
InnerSystemCall = "InnerSystemCall",
|
|
146
|
+
SystemCall = "SystemCall",
|
|
147
|
+
|
|
148
|
+
PhaseAdd = "PhaseAdd",
|
|
149
|
+
PhaseBegan = "PhaseBegan",
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
Hooks = Hooks,
|
|
154
|
+
|
|
155
|
+
systemAdd = systemAdd,
|
|
156
|
+
systemRemove = systemRemove,
|
|
157
|
+
systemReplace = systemReplace,
|
|
158
|
+
systemCleanup = systemCleanup,
|
|
159
|
+
systemCall = systemCall,
|
|
160
|
+
systemError = systemError,
|
|
161
|
+
phaseAdd = phaseAdd,
|
|
162
|
+
phaseBegan = phaseBegan,
|
|
163
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Scheduler } from "./Scheduler";
|
|
2
|
+
|
|
3
|
+
export * from "./conditions";
|
|
4
|
+
export * from "./Phase";
|
|
5
|
+
export * from "./Pipeline";
|
|
6
|
+
export * from "./Scheduler";
|
|
7
|
+
|
|
8
|
+
export interface Plugin<T extends unknown[]> {
|
|
9
|
+
build(scheduler: Scheduler<T>): void;
|
|
10
|
+
cleanup?(): void;
|
|
11
|
+
[key: string | number | symbol]: any;
|
|
12
|
+
}
|
package/src/init.luau
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
local Phase = require(script.Phase) :: any
|
|
2
|
+
local Pipeline = require(script.Pipeline) :: any
|
|
3
|
+
local Scheduler = require(script.Scheduler) :: any
|
|
4
|
+
|
|
5
|
+
local conditions = require(script.conditions)
|
|
6
|
+
local utils = require(script.utils)
|
|
7
|
+
|
|
8
|
+
type GenericTable = utils.GenericTable
|
|
9
|
+
type SignalLike<U...> = utils.SignalLike<U...>
|
|
10
|
+
type ConnectionLike = utils.ConnectionLike
|
|
11
|
+
type ConnectFn<T, U...> = utils.ConnectFn<T, U...>
|
|
12
|
+
type Callback<U...> = utils.Callback<U...>
|
|
13
|
+
|
|
14
|
+
export type CleanupFn<U...> = (U...) -> ()
|
|
15
|
+
|
|
16
|
+
export type SystemFn<U...> = (U...) -> ()
|
|
17
|
+
|
|
18
|
+
export type InitializerResult<U...> = {
|
|
19
|
+
system: SystemFn<U...>?,
|
|
20
|
+
cleanup: CleanupFn<U...>?,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type InitializerSystemFn<U...> =
|
|
24
|
+
| ((U...) -> SystemFn<U...>)
|
|
25
|
+
| ((U...) -> (SystemFn<U...>, CleanupFn<U...>))
|
|
26
|
+
| ((U...) -> InitializerResult<U...>)
|
|
27
|
+
|
|
28
|
+
export type SystemTable<U...> = {
|
|
29
|
+
system: SystemFn<U...> | InitializerSystemFn<U...>,
|
|
30
|
+
phase: Phase?,
|
|
31
|
+
name: string?,
|
|
32
|
+
runConditions: { (U...) -> boolean }?,
|
|
33
|
+
[any]: any,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type System<U...> =
|
|
37
|
+
SystemFn<U...>
|
|
38
|
+
| InitializerSystemFn<U...>
|
|
39
|
+
| SystemTable<U...>
|
|
40
|
+
|
|
41
|
+
export type Phase = {
|
|
42
|
+
PreStartup: Phase,
|
|
43
|
+
Startup: Phase,
|
|
44
|
+
PostStartup: Phase,
|
|
45
|
+
|
|
46
|
+
new: (debugName: string?) -> Phase,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type Pipeline = {
|
|
50
|
+
Startup: Pipeline,
|
|
51
|
+
|
|
52
|
+
insert: (self: Pipeline, phase: Phase) -> Pipeline,
|
|
53
|
+
insertAfter: (self: Pipeline, phase: Phase, after: Phase) -> Pipeline,
|
|
54
|
+
insertBefore: (self: Pipeline, phase: Phase, before: Phase) -> Pipeline,
|
|
55
|
+
new: (debugName: string?) -> Pipeline,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type Plugin<U...> =
|
|
59
|
+
{
|
|
60
|
+
build: (self: Plugin<U...>, scheduler: Scheduler<U...>) -> (),
|
|
61
|
+
[any]: any,
|
|
62
|
+
}
|
|
63
|
+
| {
|
|
64
|
+
build: (self: Plugin<U...>, scheduler: Scheduler<U...>) -> (),
|
|
65
|
+
cleanup: (self: Plugin<U...>) -> (),
|
|
66
|
+
[any]: any,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type Scheduler<U...> = {
|
|
70
|
+
addPlugin: (self: Scheduler<U...>, plugin: Plugin<U...>) -> Scheduler<U...>,
|
|
71
|
+
|
|
72
|
+
addSystem: (
|
|
73
|
+
self: Scheduler<U...>,
|
|
74
|
+
system: System<U...>,
|
|
75
|
+
phase: Phase?
|
|
76
|
+
) -> Scheduler<U...>,
|
|
77
|
+
|
|
78
|
+
addSystems: (
|
|
79
|
+
self: Scheduler<U...>,
|
|
80
|
+
systems: { System<U...> },
|
|
81
|
+
phase: Phase?
|
|
82
|
+
) -> Scheduler<U...>,
|
|
83
|
+
|
|
84
|
+
editSystem: (
|
|
85
|
+
self: Scheduler<U...>,
|
|
86
|
+
system: System<U...>,
|
|
87
|
+
new: Phase
|
|
88
|
+
) -> Scheduler<U...>,
|
|
89
|
+
|
|
90
|
+
replaceSystem: (
|
|
91
|
+
self: Scheduler<U...>,
|
|
92
|
+
system: System<U...>,
|
|
93
|
+
new: System<U...>
|
|
94
|
+
) -> Scheduler<U...>,
|
|
95
|
+
|
|
96
|
+
removeSystem: (
|
|
97
|
+
self: Scheduler<U...>,
|
|
98
|
+
system: System<U...>
|
|
99
|
+
) -> Scheduler<U...>,
|
|
100
|
+
|
|
101
|
+
addRunCondition: ((
|
|
102
|
+
self: Scheduler<U...>,
|
|
103
|
+
system: System<U...>,
|
|
104
|
+
fn: (U...) -> boolean,
|
|
105
|
+
...any
|
|
106
|
+
) -> Scheduler<U...>) & ((
|
|
107
|
+
self: Scheduler<U...>,
|
|
108
|
+
phase: Phase,
|
|
109
|
+
fn: (U...) -> boolean,
|
|
110
|
+
...any
|
|
111
|
+
) -> Scheduler<U...>) & ((
|
|
112
|
+
self: Scheduler<U...>,
|
|
113
|
+
pipeline: Pipeline,
|
|
114
|
+
fn: (U...) -> boolean,
|
|
115
|
+
...any
|
|
116
|
+
) -> Scheduler<U...>),
|
|
117
|
+
|
|
118
|
+
run: ((self: Scheduler<U...>, system: System<U...>) -> Scheduler<U...>)
|
|
119
|
+
& ((self: Scheduler<U...>, phase: Phase) -> Scheduler<U...>)
|
|
120
|
+
& ((self: Scheduler<U...>, pipeline: Pipeline) -> Scheduler<U...>),
|
|
121
|
+
|
|
122
|
+
runAll: (self: Scheduler<U...>) -> Scheduler<U...>,
|
|
123
|
+
|
|
124
|
+
getDeltaTime: (self: Scheduler<U...>) -> number,
|
|
125
|
+
|
|
126
|
+
insert: ((
|
|
127
|
+
self: Scheduler<U...>,
|
|
128
|
+
dependency: Phase | Pipeline
|
|
129
|
+
) -> Scheduler<U...>)
|
|
130
|
+
-- RBXScriptSignal & nil
|
|
131
|
+
& ((
|
|
132
|
+
self: Scheduler<U...>,
|
|
133
|
+
dependency: Phase | Pipeline,
|
|
134
|
+
signal: RBXScriptSignal<U...>
|
|
135
|
+
) -> Scheduler<U...>)
|
|
136
|
+
-- Instance & RBXScriptSignal
|
|
137
|
+
-- Instance & string
|
|
138
|
+
& ((
|
|
139
|
+
self: Scheduler<U...>,
|
|
140
|
+
dependency: Phase | Pipeline,
|
|
141
|
+
instance: Instance,
|
|
142
|
+
event: RBXScriptSignal<U...> | string
|
|
143
|
+
) -> Scheduler<U...>)
|
|
144
|
+
-- SignalLike & nil
|
|
145
|
+
& ((
|
|
146
|
+
self: Scheduler<U...>,
|
|
147
|
+
dependency: Phase | Pipeline,
|
|
148
|
+
signal: SignalLike<U...>
|
|
149
|
+
) -> Scheduler<U...>)
|
|
150
|
+
-- table & string
|
|
151
|
+
& ((
|
|
152
|
+
self: Scheduler<U...>,
|
|
153
|
+
dependency: Phase | Pipeline,
|
|
154
|
+
table: GenericTable,
|
|
155
|
+
event: string
|
|
156
|
+
) -> Scheduler<U...>)
|
|
157
|
+
-- table & connectable method
|
|
158
|
+
& (<T>(
|
|
159
|
+
self: Scheduler<U...>,
|
|
160
|
+
dependency: Phase | Pipeline,
|
|
161
|
+
instance: GenericTable,
|
|
162
|
+
connectMethod: (GenericTable, Callback<U...>, ...any) -> T
|
|
163
|
+
) -> Scheduler<U...>)
|
|
164
|
+
-- connectable function
|
|
165
|
+
& (<T>(
|
|
166
|
+
self: Scheduler<U...>,
|
|
167
|
+
dependency: Phase | Pipeline,
|
|
168
|
+
connectFn: (Callback<U...>, ...any) -> T
|
|
169
|
+
) -> Scheduler<U...>),
|
|
170
|
+
|
|
171
|
+
insertAfter: ((
|
|
172
|
+
self: Scheduler<U...>,
|
|
173
|
+
phase: Phase,
|
|
174
|
+
after: Phase | Pipeline
|
|
175
|
+
) -> Scheduler<U...>) & ((
|
|
176
|
+
self: Scheduler<U...>,
|
|
177
|
+
pipeline: Pipeline,
|
|
178
|
+
after: Phase | Pipeline
|
|
179
|
+
) -> Scheduler<U...>),
|
|
180
|
+
|
|
181
|
+
insertBefore: ((
|
|
182
|
+
self: Scheduler<U...>,
|
|
183
|
+
phase: Phase,
|
|
184
|
+
before: Phase | Pipeline
|
|
185
|
+
) -> Scheduler<U...>) & ((
|
|
186
|
+
self: Scheduler<U...>,
|
|
187
|
+
pipeline: Pipeline,
|
|
188
|
+
before: Phase | Pipeline
|
|
189
|
+
) -> Scheduler<U...>),
|
|
190
|
+
|
|
191
|
+
cleanup: (self: Scheduler<U...>) -> (),
|
|
192
|
+
|
|
193
|
+
new: (U...) -> Scheduler<U...>,
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
Phase = Phase :: Phase,
|
|
198
|
+
Pipeline = Pipeline :: Pipeline,
|
|
199
|
+
Scheduler = Scheduler :: {
|
|
200
|
+
new: <U...>(U...) -> Scheduler<U...>,
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
isNot = conditions.isNot,
|
|
204
|
+
runOnce = conditions.runOnce,
|
|
205
|
+
timePassed = conditions.timePassed,
|
|
206
|
+
onEvent = conditions.onEvent,
|
|
207
|
+
}
|
package/src/utils.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type EventLike<T extends unknown[] = unknown[]> =
|
|
2
|
+
| RBXScriptSignal<(...args: T) => void>
|
|
3
|
+
| { connect(listener: (...args: T) => void): unknown }
|
|
4
|
+
| { Connect(listener: (...args: T) => void): unknown }
|
|
5
|
+
| { on(listener: (...args: T) => void): unknown };
|
|
6
|
+
export type EventInstance = Instance | { [k: string]: EventLike };
|
|
7
|
+
|
|
8
|
+
export type ExtractEvents<T extends EventInstance> = {
|
|
9
|
+
[K in keyof T]: T[K] extends EventLike ? K : never;
|
|
10
|
+
}[keyof T];
|