J3c: a land server stopping tells its players and is started afresh when they rejoin; the extra ports to forward on the Host page, the hosting message, the server log and HOSTING.md

This commit is contained in:
Paul Bailey
2026-11-07 00:08:05 +00:00
parent 86ebe07899
commit f9b138b304
9 changed files with 108 additions and 12 deletions

View File

@@ -181,6 +181,29 @@ func _body() -> void:
await _load_world()
check(world.worldlet_id() == "cove" and player.global_position.distance_to(spot) < 1.5,
"where she left off (%.1f m off)" % player.global_position.distance_to(spot))
print("the Cove's server crashes")
var why := {"text": ""}
var on_left := func(t): why.text = t
Net.left.connect(on_left)
var out: Array = []
OS.execute("lsof", ["-nP", "-t", "-iUDP:%d" % (PORT + 1)], out)
var pid := String(out[0] if not out.is_empty() else "").strip_edges().get_slice("\n", 0)
check(pid.is_valid_int(), "(found the Cove's server: pid %s)" % pid)
if pid.is_valid_int():
OS.kill(int(pid))
await _until(func(): return not String(why.text).is_empty(), 15.0)
Net.left.disconnect(on_left)
check(String(why.text).begins_with("Lost the connection to the Cove"), "Alice is told what happened (%s)" % why.text)
world.queue_free()
await process_frame
world = null
_arrived = ""
r = await _join()
await _until(func(): return not _arrived.is_empty(), 30.0)
check(_arrived == "cove", "joining again: the hub starts the Cove's server afresh and sends her back (%s)" % _arrived)
if _arrived == "cove":
await _load_world()
check(world.worldlet_id() == "cove" and player.inventory.count("antler_pickaxe") == 1, "in the Cove, with her things")
print("an admin in the Cove kicks someone in the Valley")
await _until(func(): return Net.roster.any(func(e): return String(e.name) == "Bob"), 4.0)
root.get_node("Chat").say("/kick Bob")

View File

@@ -84,6 +84,10 @@ func _body(S: Node, Net: Node) -> void:
await process_frame
check(hp.disabled and TS.picked_worldlet(hp) == "valley", "an island already made: shows its worldlet, locked")
check(title._host_seed_label.text == "Seed (kept)", "(like its seed)")
check(title._host_msg.text.contains("forward UDP 24242 and 24243 (the Cove)"),
"the Host page says which ports to forward, the Cove's too (%s)" % title._host_msg.text.get_slice("\n", 1))
var L: Node = root.get_node("Lands")
check(L.extra_ports("valley", 24242) == [["cove", 24243]], "(the Valley's lands: the Cove on 24243)")
# A worldlet that isn't a start (an island made elsewhere) is still shown.
var extra := OptionButton.new()
extra.add_item("Valley")