Pixel-Composer/objects/o_main/Other_68.gml

32 lines
985 B
Text
Raw Normal View History

2023-06-04 12:38:40 +02:00
/// @description
2023-11-22 05:17:13 +01:00
var _id = async_load[? "id"];
2024-11-20 09:05:51 +01:00
var _nid = $"net_{struct_names_count(NETWORK_LOG_DATA)}";
NETWORK_LOG_DATA[$ _nid] = ds_map_print(async_load);
array_push(NETWORK_LOG, new notification(NOTI_TYPE.internal, $"Received network event {_nid}"));
2023-06-04 12:38:40 +02:00
2024-02-15 14:23:26 +01:00
if(_id == TCP_SERVER) {
var t = async_load[? "type"];
if (t == network_type_connect) {
var sock = ds_map_find_value(async_load, "socket");
array_push(TCP_CLIENTS, sock);
log_console($"Client connected: {sock}");
} else if (t == network_type_disconnect) {
var sock = ds_map_find_value(async_load, "socket");
array_remove(TCP_CLIENTS, sock);
log_console($"Client disconnected: {sock}");
} else if (t == network_type_data) {
var _buffer = ds_map_find_value(async_load, "buffer");
var cmd_type = buffer_read(_buffer, buffer_string );
cmd_submit(cmd_type);
}
exit;
}
2023-11-22 05:17:13 +01:00
if(!ds_map_exists(PORT_MAP, _id)) exit;
var nodeTarget = PORT_MAP[? _id];
nodeTarget.asyncPackets(async_load);