fix: a lot of network sync fixes

This commit is contained in:
DottsGit
2026-06-06 20:45:10 -04:00
parent dbbfbef4a4
commit 07a15fe998
8 changed files with 179 additions and 91 deletions
+6
View File
@@ -67,6 +67,8 @@ func _build_loadout() -> void:
else:
is_auth = is_multiplayer_authority()
print("DEBUG [", multiplayer.get_unique_id(), "]: _build_loadout is_auth=", is_auth, " player=", str(player.name) if player else "null")
if not is_auth:
return # Let the player_movement_controller's remote _process call _build_remote_loadout
@@ -77,6 +79,7 @@ func _build_loadout() -> void:
weapons.clear()
var l = LoadoutManager.get_active_loadout()
print("DEBUG [", multiplayer.get_unique_id(), "]: Loadout primary1=", l["primary_1"])
if player:
player.synced_loadout_p1 = l["primary_1"]
@@ -112,15 +115,18 @@ func _build_remote_loadout(p1: String, p2: String, sp: String, melee: String) ->
func _spawn_weapon(slot: int, weapon_id: String) -> void:
if weapon_id == "" or weapon_id == "none" or not LoadoutManager.weapon_db.has(weapon_id):
print("DEBUG [", multiplayer.get_unique_id(), "]: _spawn_weapon failed check for ", weapon_id)
return
var w_data = LoadoutManager.weapon_db[weapon_id]
var script_path = w_data["script"]
if script_path == "":
print("DEBUG [", multiplayer.get_unique_id(), "]: _spawn_weapon failed script path for ", weapon_id)
return
var script = load(script_path)
if script:
print("DEBUG [", multiplayer.get_unique_id(), "]: Successfully loaded script, adding weapon ", weapon_id)
var w = script.new()
w.name = "Weapon_" + str(slot) + "_" + weapon_id
# Assuming all weapons have player and camera vars