Skip to content

Commit 851a06c

Browse files
committed
Added changed, childadded, childremoved events
1 parent 5594b6d commit 851a06c

6 files changed

Lines changed: 108 additions & 0 deletions

File tree

nodes/events/changed.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"type": "EVENT",
3+
"color": [
4+
255,
5+
0,
6+
0
7+
],
8+
"title": "Property Changed",
9+
"inputs": {
10+
"instance": {
11+
"defaultValue": ""
12+
}
13+
},
14+
"outputs": [
15+
"property"
16+
]
17+
}

nodes/events/childadded.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"type": "EVENT",
3+
"color": [
4+
255,
5+
0,
6+
0
7+
],
8+
"title": "Child Added",
9+
"inputs": {
10+
"instance": {
11+
"defaultValue": ""
12+
}
13+
},
14+
"outputs": [
15+
"child"
16+
]
17+
}

nodes/events/childremoved.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"type": "EVENT",
3+
"color": [
4+
255,
5+
0,
6+
0
7+
],
8+
"title": "Child Removed",
9+
"inputs": {
10+
"instance": {
11+
"defaultValue": ""
12+
}
13+
},
14+
"outputs": [
15+
"child"
16+
]
17+
}

src/models/events/Changed.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from typing import Optional
2+
from src.Node import Node
3+
4+
class Changed(Node):
5+
def __init__(self) -> None:
6+
super().__init__("nodes/events/changed.json")
7+
self.events_count = 1
8+
9+
def toLuau(self) -> Optional[str]:
10+
instance = self.getInputValue("instance")
11+
output_names = [o.name for o in self.outputs]
12+
args = ", ".join(output_names)
13+
14+
for output in self.outputs:
15+
self.setOutputValue(output.name, output.name)
16+
17+
r = f'{instance}.Changed:Connect(function({args})'
18+
19+
return r

src/models/events/ChildAdded.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from typing import Optional
2+
from src.Node import Node
3+
4+
class ChildAdded(Node):
5+
def __init__(self) -> None:
6+
super().__init__("nodes/events/childadded.json")
7+
self.events_count = 1
8+
9+
def toLuau(self) -> Optional[str]:
10+
instance = self.getInputValue("instance")
11+
output_names = [o.name for o in self.outputs]
12+
args = ", ".join(output_names)
13+
14+
for output in self.outputs:
15+
self.setOutputValue(output.name, output.name)
16+
17+
r = f'{instance}.ChildAdded:Connect(function({args})'
18+
19+
return r

src/models/events/ChildRemoved.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from typing import Optional
2+
from src.Node import Node
3+
4+
class ChildRemoved(Node):
5+
def __init__(self) -> None:
6+
super().__init__("nodes/events/childremoved.json")
7+
self.events_count = 1
8+
9+
def toLuau(self) -> Optional[str]:
10+
instance = self.getInputValue("instance")
11+
output_names = [o.name for o in self.outputs]
12+
args = ", ".join(output_names)
13+
14+
for output in self.outputs:
15+
self.setOutputValue(output.name, output.name)
16+
17+
r = f'{instance}.ChildRemoved:Connect(function({args})'
18+
19+
return r

0 commit comments

Comments
 (0)