mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
348823f34f
commitdb69386b6d
Author: Andrew Tang <tandrew@gmail.com> Date: Mon Aug 1 02:48:32 2022 +0800 Test Lobby Working Server creation works and others are able to join by entering the creator's IP. Shows a list of player names (currently only shows player #) commit3fbf2640da
Author: Andrew Tang <tandrew@gmail.com> Date: Mon Jul 25 02:29:27 2022 +0800 Test Multiplayer commit59b74b946a
Author: Andrew Tang <tandrew@gmail.com> Date: Mon Jul 11 01:16:34 2022 +0800 Complete DiceRoller Singleton Version Created script: "DiceRoller.gd" to be the only dice script attached to a node and will act as a singleton. A single DieManager object is created in this script. The DieManager's values can be changed and methods can be called through the DiceRoller Script commit3a402d4331
Author: Andrew Tang <90939405+TangoDevelopments@users.noreply.github.com> Date: Sun Jul 3 13:05:28 2022 -0400 Delete .DS_Store commitc00b24c60a
Author: Andrew Tang <90939405+TangoDevelopments@users.noreply.github.com> Date: Sun Jul 3 13:05:16 2022 -0400 Delete .DS_Store commit4f788de0c7
Author: Andrew Tang <90939405+TangoDevelopments@users.noreply.github.com> Date: Sun Jul 3 13:05:05 2022 -0400 Delete .DS_Store commitc20fd85567
Author: Andrew Tang <tandrew@gmail.com> Date: Mon Jul 4 00:13:15 2022 +0800 Added D10 and easier die selection
36 lines
936 B
GDScript
36 lines
936 B
GDScript
extends Node
|
|
|
|
const DEFAULT_PORT = 28960
|
|
const MAX_CLIENTS = 6
|
|
|
|
var server = null
|
|
var client = null
|
|
|
|
var ip_address = ""
|
|
|
|
func _ready() -> void:
|
|
ip_address = IP.get_local_addresses()[3]
|
|
|
|
for ip in IP.get_local_addresses():
|
|
if ip.begins_with("192.168.") and not ip.ends_with(".1"):
|
|
ip_address = ip
|
|
|
|
get_tree().connect("connected_to_server", self, "_connected_to_server")
|
|
get_tree().connect("server_disconnected", self, "_server_disconnected")
|
|
|
|
func _create_server() -> void:
|
|
server = NetworkedMultiplayerENet.new()
|
|
server.create_server(DEFAULT_PORT, MAX_CLIENTS)
|
|
get_tree().set_network_peer(server)
|
|
|
|
func _join_server() -> void:
|
|
client = NetworkedMultiplayerENet.new()
|
|
client.create_client(ip_address, DEFAULT_PORT)
|
|
get_tree().set_network_peer(client)
|
|
|
|
func _connected_to_server() -> void:
|
|
print("Successfully connected to the server")
|
|
|
|
func _server_disconnected() -> void:
|
|
print("Disconnected from the server")
|