M2.6: server rules (PvP, raiding, locks and friends, death penalty, difficulty, wolf grace), chat, admin commands, server console

This commit is contained in:
Paul Bailey
2026-11-04 22:54:40 +00:00
parent 47fc116839
commit 2ab79b68c6
26 changed files with 1195 additions and 57 deletions

View File

@@ -131,13 +131,21 @@ func _do(cmd: Dictionary) -> Dictionary:
return {"asked": true}
"life":
return life(world, root.get_node("CreatureNet"), root.get_node("PlayerNet"))
# M2.6 (tests/test_net_rules.gd).
"say":
root.get_node("Chat").say(String(cmd.text))
await create_timer(0.6).timeout
return {"heard": root.get_node("Chat").heard.duplicate()}
"heard":
return {"heard": root.get_node("Chat").heard.duplicate(), "pvp": bool(net.server_info.get("pvp", false))}
return {"error": "unknown command"}
## What this player's game shows of the server's wildlife.
static func life(w: Node3D, CN: Node, PN: Node) -> Dictionary:
var out := {"puppets": {}, "floats": [], "projectiles": CN.projectiles_seen, "howls": CN.howls_heard,
"hurts": PN.hurts, "health": w.player.survival.health, "day": w.day_night.day,
"hours": w.day_night.hours(), "statuses": w.player.survival.statuses.duplicate()}
"hours": w.day_night.hours(), "statuses": w.player.survival.statuses.duplicate(),
"weather": w.weather.state}
for cid in CN.puppets:
var c: Node3D = CN.puppets[cid]
if is_instance_valid(c):