feat: add GameState autoload — overlay states and player positions
This commit is contained in:
@@ -20,6 +20,7 @@ config/icon="res://icon.svg"
|
||||
MCPGameBridge="res://addons/godot_mcp/game_bridge/mcp_game_bridge.gd"
|
||||
NetworkManager="*res://scripts/network_manager.gd"
|
||||
SceneManager="*res://scripts/scene_manager.gd"
|
||||
GameState="*res://scripts/game_state.gd"
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
|
||||
21
ruf-der-pilze/scripts/game_state.gd
Normal file
21
ruf-der-pilze/scripts/game_state.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends Node
|
||||
|
||||
# Overlay-Zustand pro Spieler (nur auf dem DM-Client befüllt via RPC)
|
||||
# "default" = kein Overlay aktiv
|
||||
var overlay_states: Dictionary = {} # peer_id (int) → String
|
||||
|
||||
# Spieler-Positionen (nur auf dem DM-Client befüllt via sync_player_position)
|
||||
var player_positions: Dictionary = {} # peer_id (int) → {position: Vector3, rotation: Vector3}
|
||||
|
||||
|
||||
func get_overlay(peer_id: int) -> String:
|
||||
return overlay_states.get(peer_id, "default")
|
||||
|
||||
|
||||
func set_overlay_local(peer_id: int, overlay_name: String) -> void:
|
||||
overlay_states[peer_id] = overlay_name
|
||||
print("[GameState] Overlay für %d → %s" % [peer_id, overlay_name])
|
||||
|
||||
|
||||
func update_player_transform(peer_id: int, position: Vector3, rotation: Vector3) -> void:
|
||||
player_positions[peer_id] = {position = position, rotation = rotation}
|
||||
Reference in New Issue
Block a user