12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- extends Node
- var net = NetworkedMultiplayerENet.new()
- var api = MultiplayerAPI.new()
- var port = 1909
- var maxplayer = 100
- export(NodePath) var database
- var cert = load('user://Certificate/x509_Certificate.crt')
- var key = load('user://Certificate/x509_Key.key')
- func _ready():
- print('Login listening to port: ' + str(port))
- net.create_server(port, maxplayer)
- net.set_dtls_key(key)
- net.set_dtls_certificate(cert)
- net.set_dtls_enabled(true)
- self.set_custom_multiplayer(api)
- custom_multiplayer.set_root_node(self)
- custom_multiplayer.set_network_peer(net)
-
- # net.connect("peer_disconnected",self,"disc")
- net.connect("peer_connected",self,"conn")
- pass # Replace with function body.
- func _process(_delta):
- custom_multiplayer.poll()
- var playerphsyics = preload('res://playerphysics.tscn')
- func conn(id):
- print('login client connected, id: ' + str(id))
- remote func RegisterPlayer(username, password, password2, email, salt, requester):
- var message = 'registering...'
- if password != password2:
- message = 'passwords are not equal'
- if username == '':
- message = 'put in a username'
- if email.find('@') == -1 or email.find('@') == 0:
- message = 'email is invalid'
- if email.find('gmail') == -1 and email.find('outlook') == -1 and email.find('yahoo') == -1:
- message = 'not a supported email provider'
- if email.find('.com') == -1:
- message = 'email is invalid'
- rpc_id(api.get_rpc_sender_id(), 'update_status', message)
- if message == 'registering...': return
|