Fix weapons not working on client: remove is_predicting check + init loadout
- Removed the is_predicting() early-return in weapon_manager._rollback_tick which blocked all weapon actions on the client (player owned by server) - Added client-side weapon loadout initialization in player-spawner._spawn so the player has weapons immediately, before server state sync arrives - Server reconciles via rollback state sync Movement was fixed in v0.2.2 (window focus grab). This addresses the remaining 'can't switch or use weapons' issue.
This commit is contained in:
@@ -173,6 +173,15 @@ func _spawn(id: int):
|
||||
if rollback_sync and rollback_sync.has_method("process_settings"):
|
||||
rollback_sync.process_settings()
|
||||
|
||||
# On the client side, initialize weapon loadout locally so the player
|
||||
# has weapons immediately. The server will reconcile via rollback state sync.
|
||||
if not multiplayer.is_server():
|
||||
var weapon_mgr = avatar.find_child("WeaponManager")
|
||||
if weapon_mgr and weapon_mgr.has_method("set_default_loadout"):
|
||||
# Default to T team — server will correct via state sync
|
||||
weapon_mgr.set_default_loadout(1) # TeamManager.Team.T = 1
|
||||
print("[Spawner] Client-side weapon loadout initialized for peer %s" % id)
|
||||
|
||||
func get_team_spawn_point(peer_id: int, spawn_idx: int = 0) -> Vector3:
|
||||
var team := team_manager.get_team(peer_id)
|
||||
var points: Array[Marker3D]
|
||||
|
||||
Reference in New Issue
Block a user