refactor: improve multiplayer connection lifecycle
* Move client/server connection handling into game-specific networking classes * Add multiplayer data reset for disconnected clients * Clean up invalid MessageBus listeners after disconnects * Persist lobby host address and port in game data * Standardize the default server port to 8080 * Increase server address input length to support valid addresses * Remove obsolete connection and match initialization logic from base networking
This commit is contained in:
@@ -11,6 +11,14 @@ func subscribe(id: String, callback: Callable) -> void:
|
||||
message_types.get(id).append(callback)
|
||||
|
||||
|
||||
func clear_voided_listeners() -> void:
|
||||
for mtype in message_types.keys():
|
||||
var mlisteners: Array = message_types.get(mtype)
|
||||
for mlistener in mlisteners:
|
||||
if mlistener.is_valid(): continue
|
||||
mlisteners.erase(mlistener)
|
||||
|
||||
|
||||
func emit_local(id: String, data: Variant, expand: bool = false) -> void:
|
||||
emit_propagation(id, data, expand)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user