J3b: chat, the player list (with each player's land) and admin commands across lands; sleep needs everyone in every land, with a 'waiting for everyone else' message
This commit is contained in:
@@ -232,6 +232,7 @@ func stop() -> void:
|
||||
_states.clear()
|
||||
server_info.clear()
|
||||
world_info.clear()
|
||||
roster.clear()
|
||||
_out_q.clear()
|
||||
_in_q.clear()
|
||||
local_peer = 0
|
||||
@@ -514,6 +515,42 @@ func _quiet_stop() -> void:
|
||||
func is_travelling() -> bool:
|
||||
return not _travel.is_empty()
|
||||
|
||||
# --- everyone on every land (J3b, lands.gd) -------------------------------------------
|
||||
|
||||
## Client: everyone on the server, whichever land they're in: [{"name",
|
||||
## "id", "land", "admin"}] (the hub's roster). Empty on a server with only
|
||||
## one land running: then `players` is everyone.
|
||||
var roster: Array = []
|
||||
|
||||
## Server: everyone here gets the roster.
|
||||
func push_roster() -> void:
|
||||
for peer in players:
|
||||
_s2c_roster.rpc_id(peer, Lands.roster)
|
||||
|
||||
@rpc("authority", "call_remote", "reliable")
|
||||
func _s2c_roster(list: Array) -> void:
|
||||
roster = list
|
||||
players_changed.emit()
|
||||
|
||||
## Everyone on the server to show in a list: the roster, or (one land) just
|
||||
## those here. [{"name", "admin", "land"}]
|
||||
func everyone() -> Array:
|
||||
if not roster.is_empty():
|
||||
return roster
|
||||
var out: Array = []
|
||||
for p in players.values():
|
||||
out.append({"name": String(p.name), "admin": bool(p.get("admin", false)), "land": String(world_info.get("worldlet", ""))})
|
||||
return out
|
||||
|
||||
## Server: server.json read again (the hub changed it: a /set, a ban, a
|
||||
## new admin, a friend), keeping this run's command-line overrides.
|
||||
func reload_config() -> void:
|
||||
if config == null:
|
||||
return
|
||||
var ov: Dictionary = config.overrides
|
||||
config = ServerConfig.open(config.path)
|
||||
config.overrides = ov
|
||||
|
||||
## Everyone gets the clock now (after a night's sleep, an admin's /time).
|
||||
func push_clock() -> void:
|
||||
_clock_left = CLOCK_INTERVAL
|
||||
|
||||
Reference in New Issue
Block a user