Include movement/cell/worldspace in transforms
Extend transform packets to carry movement metadata and optional cell/worldspace IDs. Public API updated (SendTransformPacket signature) and implementation now formats movementType, cellId and worldspaceId when present (buffer size increased and formatting safety checks added). Player tracking in main.cpp now computes PlayerLocation, detects cell/worldspace changes and large teleports (threshold 5000), sends immediate updates with movementType="cell_change"/"worldspace_change"/"teleport", and preserves last-sent state. Server logging updated to print movementType and extra fields. Dev log updated with an entry describing these changes.
This commit is contained in:
+12
-1
@@ -65,9 +65,20 @@ def print_packet(client: str, packet: dict[str, Any]) -> None:
|
||||
log(f"Malformed transform packet from {client}: {packet}")
|
||||
return
|
||||
|
||||
movement_type = packet.get("movementType", "normal")
|
||||
extra_fields = []
|
||||
for field_name in ("cellId", "worldspaceId"):
|
||||
if field_name in packet:
|
||||
extra_fields.append(f"{field_name}={packet[field_name]}")
|
||||
|
||||
extra_details = ""
|
||||
if extra_fields:
|
||||
extra_details = ", " + ", ".join(extra_fields)
|
||||
|
||||
log(
|
||||
"Transform from "
|
||||
f"{client}: x={x:.2f}, y={y:.2f}, z={z:.2f}, angleZ={angle_z:.2f}"
|
||||
f"{client}: x={x:.2f}, y={y:.2f}, z={z:.2f}, angleZ={angle_z:.2f}, "
|
||||
f"movementType={movement_type}{extra_details}"
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user