fix(multiplayer): replicate per-player avatar loadout and preserve original materials
checkpoint / checkpoint (push) Successful in 5m57s

This commit is contained in:
2026-09-17 16:42:15 +00:00
parent 7c77c0b447
commit 50598a0dcb
10 changed files with 395 additions and 60 deletions
+11
View File
@@ -22,6 +22,9 @@ var spawn_position: Vector3 = Vector3(0, 1.5, 0)
## the client can drop acked inputs and replay the rest).
var last_applied_seq: int = 0
## Replicated avatar loadout (base_body, slots, skin_tone).
var loadout: Dictionary = {}
## Queue of {seq:int, move_x:float, move_z:float, jump:bool, look_yaw:float}
## appended by rpc_request_input, drained each physics frame.
var _input_queue: Array[Dictionary] = []
@@ -76,6 +79,7 @@ func get_server_state() -> Dictionary:
"rotation_y": rotation.y,
"velocity": velocity,
"on_floor": is_on_floor(),
"loadout": loadout,
}
@@ -84,3 +88,10 @@ func rpc_request_input(input: Dictionary, seq: int) -> void:
var d := input.duplicate()
d["seq"] = seq
_input_queue.append(d)
@rpc("any_peer", "call_remote", "reliable")
func rpc_set_loadout(p_loadout: Dictionary) -> void:
var sender := multiplayer.get_remote_sender_id()
if sender == peer_id or sender == 1 or sender == 0:
loadout = p_loadout.duplicate(true)