This commit is contained in:
Forrest 2026-10-04 17:30:48 -04:00
parent 4298caf5cb
commit 2e6638b744
19 changed files with 484 additions and 185 deletions

View file

@ -11,12 +11,14 @@ extends SceneTree
## (127.0.0.1), for networks where broadcasts reach this machine. --online plays over GD-Sync's
## servers instead (needs the API keys): the partner finds the host's lobby in the online list.
## --host-name=Ana names the host (and so its lobby, "Ana's farm"); give both sides the same one.
## --address=192.168.1.20 joins a host at that address (LAN) instead of 127.0.0.1.
var role := "host"
var seconds := 20.0
var discover := false
var online := false
var host_name := "Ana"
var address := "127.0.0.1"
## --shot=path: a screenshot at night with the enemies in (needs a window, not --headless).
var shot := ""
var main: Main
@ -35,6 +37,8 @@ func _initialize() -> void:
online = true
elif String(a).begins_with("--host-name="):
host_name = String(a).trim_prefix("--host-name=")
elif String(a).begins_with("--address="):
address = String(a).trim_prefix("--address=")
elif String(a).begins_with("--seconds="):
seconds = float(String(a).trim_prefix("--seconds="))
_run.call_deferred()
@ -103,7 +107,7 @@ func _run() -> void:
_check(true, "found %s %s" % [found[0]["name"], "online" if online else "on the network"])
lobby.join(String(found[0]["name"]))
else:
lobby.join_address("127.0.0.1", "Ben")
lobby.join_address(address, "Ben")
if not await _wait(func() -> bool: return sim.coop.is_client() and sim.coop._is_welcomed, 40.0):
_check(false, "joined and got the farm within 40 s")
await _finish()