mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
715086f204
Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/92 Co-authored-by: Lera Elvoé <yagich@poto.cafe> Co-committed-by: Lera Elvoé <yagich@poto.cafe>
36 lines
969 B
GDScript
36 lines
969 B
GDScript
# (c) 2023-present Eroax
|
|
# (c) 2023-present Yagich
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
extends RPCScope
|
|
|
|
|
|
func _init() -> void:
|
|
name = "deck"
|
|
|
|
operation_types = {
|
|
"add_node": add_node,
|
|
}
|
|
|
|
RPCSignalLayer.signals.deck_node_added.connect(_on_deck_node_added)
|
|
|
|
|
|
func add_node(r: RPCRequest) -> void:
|
|
reconnect(
|
|
RPCSignalLayer.signals.deck_node_added,
|
|
_on_deck_node_added,
|
|
func():
|
|
var deck := DeckHolder.get_deck(r.operation.condition.deck_id)
|
|
var node := deck.add_node_type(r.operation.payload.node_type)
|
|
|
|
var node_partial := RPCNodePartial.new()
|
|
node_partial.deck_id = deck.id
|
|
node_partial.id = node._id
|
|
|
|
var resp := create_response(r, node_partial)
|
|
resp.create_event_counterpart(node_partial)
|
|
response.emit(resp)
|
|
)
|
|
|
|
|
|
func _on_deck_node_added(deck_id: String, node_id: String) -> void:
|
|
event.emit(create_event("node_added", {"node_id": node_id}, {"deck_id": deck_id}))
|