浏览代码

Remove broken `int` type check in WebRTC Signaling demo (#1186)

JSON.parse_string() parses all numbers as floats, even if there are no decimals.
`str(JSON.parse_string('{"type": 3}').asdf)` would result in `"3.0"`, which is not a valid int.
Because of this, the demo is not working.
J.M. de Jong 5 月之前
父节点
当前提交
d21c03d09c
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      networking/webrtc_signaling/client/ws_webrtc_client.gd

+ 2 - 4
networking/webrtc_signaling/client/ws_webrtc_client.gd

@@ -64,11 +64,9 @@ func _parse_msg() -> bool:
 		return false
 		return false
 
 
 	var msg := parsed as Dictionary
 	var msg := parsed as Dictionary
-	if not str(msg.type).is_valid_int() or not str(msg.id).is_valid_int():
-		return false
 
 
-	var type := str(msg.type).to_int()
-	var src_id := str(msg.id).to_int()
+	var type := int(msg.type)
+	var src_id := int(msg.id)
 
 
 	if type == Message.ID:
 	if type == Message.ID:
 		connected.emit(src_id, msg.data == "true")
 		connected.emit(src_id, msg.data == "true")