Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 00c9e85527 | |||
| 203175178f |
@@ -1,5 +1,13 @@
|
|||||||
## [NEXT]
|
## [NEXT]
|
||||||
|
|
||||||
|
## [2.4.6] — 2026-07-09
|
||||||
|
- Fixed NakamaMultiplayerBridge dictionary lookup crash when receiving match state before user presence is populated by creating a `SafeNakamaMultiplayerBridge` subclass.
|
||||||
|
|
||||||
|
## [2.4.5] — 2026-07-09
|
||||||
|
- Fixed missing `player_goals` dictionary declaration in GoalsCycleManager.
|
||||||
|
- Improved Candy Survival manager sync and LobbyManager initialization.
|
||||||
|
- Updated EnhancedGridMap and Main scene synchronization.
|
||||||
|
|
||||||
## [2.4.4] — 2026-07-09
|
## [2.4.4] — 2026-07-09
|
||||||
- Fixed Candy Survival Knock mechanic: pressing Q now properly knocks adjacent players diagonally and cardinally.
|
- Fixed Candy Survival Knock mechanic: pressing Q now properly knocks adjacent players diagonally and cardinally.
|
||||||
- Implemented Candy Survival Knock backfire mechanic: knocking a player with 0 candies transfers your candy stack to them and staggers you.
|
- Implemented Candy Survival Knock backfire mechanic: knocking a player with 0 candies transfers your candy stack to them and staggers you.
|
||||||
|
|||||||
@@ -144,3 +144,13 @@ This document serves as an exhaustive, technical record of all modifications, re
|
|||||||
- [x] Baked terrain height shifts directly into `.tscn` files to match the reference tile perfectly.
|
- [x] Baked terrain height shifts directly into `.tscn` files to match the reference tile perfectly.
|
||||||
- [x] Scaled red `non-walkable` blocks (Tile 4) to 0 so they act as invisible collision walls in 3D arenas.
|
- [x] Scaled red `non-walkable` blocks (Tile 4) to 0 so they act as invisible collision walls in 3D arenas.
|
||||||
- [x] Fixed Stop N Go safe zone clipping by adjusting render priorities (`1` for safe zone, `-1` for baked terrain shadows).
|
- [x] Fixed Stop N Go safe zone clipping by adjusting render priorities (`1` for safe zone, `-1` for baked terrain shadows).
|
||||||
|
- [x] **Candy Survival Multiplayer Client Arena & NPC Desync Fixes**
|
||||||
|
- [x] Fixed client-side arena desync where `CandySurvivalManager._apply_arena_setup()` was empty (`pass`), leaving clients without the 18x18 Floor 0 grid or sticky boundary walls.
|
||||||
|
- [x] Added `@rpc("authority", "call_remote", "reliable") func sync_arena_setup()` and updated `_apply_arena_setup()` to construct the 18x18 arena floor, apply sticky walls, and deterministically spawn `CandySurvivalNpc` (`mekton_node`) across both host and clients.
|
||||||
|
- [x] Synced `sync_arena_setup` during `sync_state_to_player(peer_id)` so late-joining or resyncing clients receive the full arena structure and NPC node before incoming state RPCs.
|
||||||
|
- [x] Added `can_rpc()` connectivity checks before sending RPCs (`set_face_color_rpc`, `sync_bump`, `apply_stagger`) to prevent remote packet errors or client drops.
|
||||||
|
- [x] **Game Mode Switching Lag & Arena Desync Fixes**
|
||||||
|
- [x] Fixed `Engine.time_scale` persistence: Ensured `Engine.time_scale = 1.0` is restored in `Main._ready()`, `CandySurvivalManager._exit_tree()`, and `LobbyManager.leave_room()` so high-speed scales (`SR_SPEED`) do not carry over across scene transitions or cause physics stutter when switching game modes.
|
||||||
|
- [x] Fixed `EnhancedGridMap` auto-randomization conflict: Updated safety check so `EnhancedGridMap._ready()` skips auto-randomizing when `LobbyManager.game_mode` is either `"Stop n Go"` or `"Candy Survival"`, avoiding unnecessary 14x14 generation before game mode managers set up custom arena bounds.
|
||||||
|
- [x] Fixed `sync_full_grid_data()` client-side arena setup: Added `"Candy Survival"` check so clients reapply `candy_survival_manager._apply_arena_setup()` prior to syncing Floor 1 items instead of overwriting Floor 0 with 14x14 Freemode tiles.
|
||||||
|
- [x] Fixed `GoalsCycleManager` process persistence: Added `reset()` to stop `_process` execution and clean up active cycle/match state when leaving rooms or returning to lobby.
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ func _ready():
|
|||||||
# Safety check: Don't auto-randomize if game mode manages its own arena
|
# Safety check: Don't auto-randomize if game mode manages its own arena
|
||||||
if not (ResourceLoader.exists("res://scripts/managers/lobby_manager.gd") \
|
if not (ResourceLoader.exists("res://scripts/managers/lobby_manager.gd") \
|
||||||
and get_node_or_null("/root/LobbyManager") \
|
and get_node_or_null("/root/LobbyManager") \
|
||||||
and (get_node("/root/LobbyManager").game_mode == "Stop n Go")):
|
and (get_node("/root/LobbyManager").game_mode in ["Stop n Go", "Candy Survival"])):
|
||||||
randomize_grid()
|
randomize_grid()
|
||||||
validate_item_indices()
|
validate_item_indices()
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,27 @@
|
|||||||
{
|
{
|
||||||
"latest_version": "2.4.4",
|
"latest_version": "2.4.6",
|
||||||
"minimum_app_version": "2.1.0",
|
"minimum_app_version": "2.1.0",
|
||||||
"releases": [
|
"releases": [
|
||||||
|
{
|
||||||
|
"version": "2.4.6",
|
||||||
|
"date": "2026-07-09",
|
||||||
|
"pck_url": "https://git.klud.top/danchie/tekton/raw/branch/patches/patch.pck",
|
||||||
|
"pck_size": 0,
|
||||||
|
"changelog": [
|
||||||
|
"Fixed NakamaMultiplayerBridge dictionary lookup crash when receiving match state before user presence is populated by creating a `SafeNakamaMultiplayerBridge` subclass."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "2.4.5",
|
||||||
|
"date": "2026-07-09",
|
||||||
|
"pck_url": "https://git.klud.top/danchie/tekton/raw/branch/patches/patch.pck",
|
||||||
|
"pck_size": 0,
|
||||||
|
"changelog": [
|
||||||
|
"Fixed missing `player_goals` dictionary declaration in GoalsCycleManager.",
|
||||||
|
"Improved Candy Survival manager sync and LobbyManager initialization.",
|
||||||
|
"Updated EnhancedGridMap and Main scene synchronization."
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "2.4.4",
|
"version": "2.4.4",
|
||||||
"date": "2026-07-09",
|
"date": "2026-07-09",
|
||||||
|
|||||||
+4
-4
@@ -14,7 +14,7 @@ custom_features=""
|
|||||||
export_filter="all_resources"
|
export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="build/windows/tekton_armageddon_v2.4.4.exe"
|
export_path="build/windows/tekton_armageddon_v2.4.6.exe"
|
||||||
patches=PackedStringArray()
|
patches=PackedStringArray()
|
||||||
patch_delta_encoding=false
|
patch_delta_encoding=false
|
||||||
patch_delta_compression_level_zstd=19
|
patch_delta_compression_level_zstd=19
|
||||||
@@ -85,7 +85,7 @@ custom_features=""
|
|||||||
export_filter="all_resources"
|
export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="build/tekton-dash-armageddon-v.2.4.4.apk"
|
export_path="build/tekton-dash-armageddon-v.2.4.6.apk"
|
||||||
patches=PackedStringArray()
|
patches=PackedStringArray()
|
||||||
patch_delta_encoding=false
|
patch_delta_encoding=false
|
||||||
patch_delta_compression_level_zstd=19
|
patch_delta_compression_level_zstd=19
|
||||||
@@ -314,7 +314,7 @@ custom_features=""
|
|||||||
export_filter="all_resources"
|
export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="build/tekton_armageddon_v2.4.4.zip"
|
export_path="build/tekton_armageddon_v2.4.6.zip"
|
||||||
patches=PackedStringArray()
|
patches=PackedStringArray()
|
||||||
patch_delta_encoding=false
|
patch_delta_encoding=false
|
||||||
patch_delta_compression_level_zstd=19
|
patch_delta_compression_level_zstd=19
|
||||||
@@ -589,7 +589,7 @@ custom_features=""
|
|||||||
export_filter="all_resources"
|
export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="build/linux/tekton_armageddon_v2.4.4.x86_64"
|
export_path="build/linux/tekton_armageddon_v2.4.6.x86_64"
|
||||||
patches=PackedStringArray()
|
patches=PackedStringArray()
|
||||||
patch_delta_encoding=false
|
patch_delta_encoding=false
|
||||||
patch_delta_compression_level_zstd=19
|
patch_delta_compression_level_zstd=19
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Tekton Dash Armageddon"
|
config/name="Tekton Dash Armageddon"
|
||||||
config/version="2.4.4"
|
config/version="2.4.6"
|
||||||
run/main_scene="res://scenes/ui/boot_screen.tscn"
|
run/main_scene="res://scenes/ui/boot_screen.tscn"
|
||||||
config/features=PackedStringArray("4.6", "Forward Plus")
|
config/features=PackedStringArray("4.6", "Forward Plus")
|
||||||
boot_splash/bg_color=Color(0.16470589, 0.6745098, 0.9372549, 1)
|
boot_splash/bg_color=Color(0.16470589, 0.6745098, 0.9372549, 1)
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ func _can_rpc() -> bool:
|
|||||||
return true
|
return true
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
# Always ensure time scale is normal when entering Main
|
||||||
|
Engine.time_scale = 1.0
|
||||||
# Initialize scene managers
|
# Initialize scene managers
|
||||||
_init_managers()
|
_init_managers()
|
||||||
|
|
||||||
@@ -2078,6 +2080,13 @@ func sync_full_grid_data(data: PackedInt32Array):
|
|||||||
stop_n_go_manager.name = "StopNGoManager"
|
stop_n_go_manager.name = "StopNGoManager"
|
||||||
add_child(stop_n_go_manager)
|
add_child(stop_n_go_manager)
|
||||||
stop_n_go_manager._apply_arena_setup()
|
stop_n_go_manager._apply_arena_setup()
|
||||||
|
elif LobbyManager.game_mode == "Candy Survival":
|
||||||
|
if not candy_survival_manager:
|
||||||
|
candy_survival_manager = load("res://scripts/managers/candy_survival_manager.gd").new()
|
||||||
|
candy_survival_manager.name = "CandySurvivalManager"
|
||||||
|
add_child(candy_survival_manager)
|
||||||
|
candy_survival_manager.initialize(self, enhanced_gridmap)
|
||||||
|
candy_survival_manager._apply_arena_setup()
|
||||||
else:
|
else:
|
||||||
# Freemode: Ensure Floor 0 is entirely walkable (reset stale state from previous modes)
|
# Freemode: Ensure Floor 0 is entirely walkable (reset stale state from previous modes)
|
||||||
for x in range(enhanced_gridmap.columns):
|
for x in range(enhanced_gridmap.columns):
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ extends Node
|
|||||||
## AuthManager - Centralized authentication handling for Nakama
|
## AuthManager - Centralized authentication handling for Nakama
|
||||||
## Supports: Guest (device ID), Email/Password, Social (Google, Apple, Facebook)
|
## Supports: Guest (device ID), Email/Password, Social (Google, Apple, Facebook)
|
||||||
|
|
||||||
|
const SafeNakamaMultiplayerBridge = preload("res://scripts/services/safe_nakama_multiplayer_bridge.gd")
|
||||||
|
|
||||||
# Signals
|
# Signals
|
||||||
signal auth_started
|
signal auth_started
|
||||||
signal auth_completed(success: bool, user_data: Dictionary)
|
signal auth_completed(success: bool, user_data: Dictionary)
|
||||||
@@ -472,7 +474,7 @@ func _connect_socket() -> bool:
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
# Initialize multiplayer bridge
|
# Initialize multiplayer bridge
|
||||||
NakamaManager.bridge = NakamaMultiplayerBridge.new(NakamaManager.socket)
|
NakamaManager.bridge = SafeNakamaMultiplayerBridge.new(NakamaManager.socket)
|
||||||
NakamaManager.bridge.match_joined.connect(NakamaManager._on_bridge_match_joined)
|
NakamaManager.bridge.match_joined.connect(NakamaManager._on_bridge_match_joined)
|
||||||
NakamaManager.bridge.match_join_error.connect(NakamaManager._on_bridge_match_join_error)
|
NakamaManager.bridge.match_join_error.connect(NakamaManager._on_bridge_match_join_error)
|
||||||
multiplayer.set_multiplayer_peer(NakamaManager.bridge.multiplayer_peer)
|
multiplayer.set_multiplayer_peer(NakamaManager.bridge.multiplayer_peer)
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ func _ready():
|
|||||||
set_process(false)
|
set_process(false)
|
||||||
_setup_hud()
|
_setup_hud()
|
||||||
|
|
||||||
|
func _exit_tree() -> void:
|
||||||
|
Engine.time_scale = 1.0
|
||||||
|
|
||||||
func _setup_hud() -> void:
|
func _setup_hud() -> void:
|
||||||
var hud_instance = _candy_survival_hud_scene.instantiate()
|
var hud_instance = _candy_survival_hud_scene.instantiate()
|
||||||
hud_layer = hud_instance
|
hud_layer = hud_instance
|
||||||
@@ -203,8 +206,11 @@ func _process(delta: float) -> void:
|
|||||||
current_face = CandyColor.values()[(current_face + 1) % CandyColor.size()]
|
current_face = CandyColor.values()[(current_face + 1) % CandyColor.size()]
|
||||||
|
|
||||||
# Sync color to the Mekton NPC
|
# Sync color to the Mekton NPC
|
||||||
if mekton_node and mekton_node.has_method("set_face_color_rpc"):
|
if mekton_node and is_instance_valid(mekton_node) and mekton_node.has_method("set_face_color_rpc"):
|
||||||
|
if multiplayer.is_server() and can_rpc():
|
||||||
mekton_node.rpc("set_face_color_rpc", current_face)
|
mekton_node.rpc("set_face_color_rpc", current_face)
|
||||||
|
else:
|
||||||
|
mekton_node.set_face_color_rpc(current_face)
|
||||||
|
|
||||||
# Update delivery indicators for all players based on new face
|
# Update delivery indicators for all players based on new face
|
||||||
for pid in player_candies:
|
for pid in player_candies:
|
||||||
@@ -399,6 +405,7 @@ func try_knock(attacker: int, target: int) -> bool:
|
|||||||
var target_node = _find_player_node(target)
|
var target_node = _find_player_node(target)
|
||||||
|
|
||||||
if attacker_node and target_node:
|
if attacker_node and target_node:
|
||||||
|
if attacker_node.has_method("can_rpc") and attacker_node.can_rpc():
|
||||||
attacker_node.rpc("sync_bump", target_node.current_position)
|
attacker_node.rpc("sync_bump", target_node.current_position)
|
||||||
|
|
||||||
if target_candies == 0:
|
if target_candies == 0:
|
||||||
@@ -408,7 +415,10 @@ func try_knock(attacker: int, target: int) -> bool:
|
|||||||
|
|
||||||
# Attacker is knocked down briefly (backfire)
|
# Attacker is knocked down briefly (backfire)
|
||||||
if attacker_node:
|
if attacker_node:
|
||||||
|
if attacker_node.has_method("can_rpc") and attacker_node.can_rpc():
|
||||||
attacker_node.rpc("apply_stagger", 2.0)
|
attacker_node.rpc("apply_stagger", 2.0)
|
||||||
|
elif attacker_node.has_method("apply_stagger"):
|
||||||
|
attacker_node.apply_stagger(2.0)
|
||||||
|
|
||||||
# Backfire penalty: Attacker's candy stack transfers to Target!
|
# Backfire penalty: Attacker's candy stack transfers to Target!
|
||||||
var attacker_colors = player_candy_colors.get(attacker, [])
|
var attacker_colors = player_candy_colors.get(attacker, [])
|
||||||
@@ -444,7 +454,10 @@ func try_knock(attacker: int, target: int) -> bool:
|
|||||||
|
|
||||||
# Target is knocked down / staggered on successful knock
|
# Target is knocked down / staggered on successful knock
|
||||||
if target_node:
|
if target_node:
|
||||||
|
if target_node.has_method("can_rpc") and target_node.can_rpc():
|
||||||
target_node.rpc("apply_stagger", 2.0)
|
target_node.rpc("apply_stagger", 2.0)
|
||||||
|
elif target_node.has_method("apply_stagger"):
|
||||||
|
target_node.apply_stagger(2.0)
|
||||||
|
|
||||||
_add_score(attacker, target_candies * 100)
|
_add_score(attacker, target_candies * 100)
|
||||||
_update_candy_badge(attacker)
|
_update_candy_badge(attacker)
|
||||||
@@ -485,9 +498,38 @@ func try_activate_ghost(pid: int) -> bool:
|
|||||||
func is_ghost_active(pid: int) -> bool:
|
func is_ghost_active(pid: int) -> bool:
|
||||||
return player_ghost_active.get(pid, false)
|
return player_ghost_active.get(pid, false)
|
||||||
|
|
||||||
|
func can_rpc() -> bool:
|
||||||
|
if not multiplayer.has_multiplayer_peer() or multiplayer.multiplayer_peer.get_connection_status() != MultiplayerPeer.CONNECTION_CONNECTED:
|
||||||
|
return false
|
||||||
|
return true
|
||||||
|
|
||||||
# ── Arena ──
|
# ── Arena ──
|
||||||
|
|
||||||
func _setup_arena() -> void:
|
func _setup_arena() -> void:
|
||||||
|
if not gridmap:
|
||||||
|
return
|
||||||
|
if can_rpc():
|
||||||
|
rpc("sync_arena_setup")
|
||||||
|
_apply_arena_setup()
|
||||||
|
|
||||||
|
@rpc("authority", "call_remote", "reliable")
|
||||||
|
func sync_arena_setup() -> void:
|
||||||
|
print("[CandySurvival] Client: Syncing Arena Setup (18x18)...")
|
||||||
|
_apply_arena_setup()
|
||||||
|
|
||||||
|
func _spawn_mekton_npc(center: Vector2i) -> Node:
|
||||||
|
var path = "res://scenes/candy_survival_npc.tscn"
|
||||||
|
if ResourceLoader.exists(path):
|
||||||
|
var npc = load(path).instantiate()
|
||||||
|
npc.name = "CandySurvivalNpc"
|
||||||
|
npc.position = Vector3(center.x + 1, 0, center.y + 1)
|
||||||
|
add_child(npc, true)
|
||||||
|
if npc.has_method("set_face_color_rpc"):
|
||||||
|
npc.set_face_color_rpc(current_face)
|
||||||
|
return npc
|
||||||
|
return null
|
||||||
|
|
||||||
|
func _apply_arena_setup() -> void:
|
||||||
if not gridmap:
|
if not gridmap:
|
||||||
return
|
return
|
||||||
gridmap.set("columns", ARENA_COLS)
|
gridmap.set("columns", ARENA_COLS)
|
||||||
@@ -504,24 +546,10 @@ func _setup_arena() -> void:
|
|||||||
gridmap.set_cell_item(Vector3i(pos.x, 2, pos.y), 14)
|
gridmap.set_cell_item(Vector3i(pos.x, 2, pos.y), 14)
|
||||||
|
|
||||||
# Spawn Mekton NPC at center
|
# Spawn Mekton NPC at center
|
||||||
if mekton_node:
|
if mekton_node and is_instance_valid(mekton_node):
|
||||||
mekton_node.queue_free()
|
mekton_node.queue_free()
|
||||||
mekton_node = _spawn_mekton_npc(NPC_CENTER)
|
mekton_node = _spawn_mekton_npc(NPC_CENTER)
|
||||||
print("[CandySurvival] Arena setup 18x18")
|
print("[CandySurvival] Arena setup applied 18x18")
|
||||||
|
|
||||||
func _spawn_mekton_npc(center: Vector2i) -> Node:
|
|
||||||
var path = "res://scenes/candy_survival_npc.tscn"
|
|
||||||
if ResourceLoader.exists(path):
|
|
||||||
var npc = load(path).instantiate()
|
|
||||||
npc.position = Vector3(center.x + 1, 0, center.y + 1)
|
|
||||||
add_child(npc)
|
|
||||||
if npc.has_method("set_face_color_rpc"):
|
|
||||||
npc.set_face_color_rpc(current_face)
|
|
||||||
return npc
|
|
||||||
return null
|
|
||||||
|
|
||||||
func _apply_arena_setup() -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
func setup_mission_tiles() -> void:
|
func setup_mission_tiles() -> void:
|
||||||
if not gridmap:
|
if not gridmap:
|
||||||
@@ -697,8 +725,13 @@ func sync_ghost_active(pid: int, active_on: bool) -> void:
|
|||||||
hud_ghost_label.text = "👻 Ghosts: %d" % player_ghosts[pid]
|
hud_ghost_label.text = "👻 Ghosts: %d" % player_ghosts[pid]
|
||||||
|
|
||||||
func sync_state_to_player(peer_id: int) -> void:
|
func sync_state_to_player(peer_id: int) -> void:
|
||||||
|
# Ensure the client gets the arena setup before state
|
||||||
|
if can_rpc():
|
||||||
|
rpc_id(peer_id, "sync_arena_setup")
|
||||||
|
|
||||||
# Sync Mekton's current face color
|
# Sync Mekton's current face color
|
||||||
if mekton_node and mekton_node.has_method("set_face_color_rpc"):
|
if mekton_node and is_instance_valid(mekton_node) and mekton_node.has_method("set_face_color_rpc"):
|
||||||
|
if can_rpc():
|
||||||
mekton_node.rpc_id(peer_id, "set_face_color_rpc", current_face)
|
mekton_node.rpc_id(peer_id, "set_face_color_rpc", current_face)
|
||||||
|
|
||||||
# Sync Ghost inventory to make the HUD button visible on player load
|
# Sync Ghost inventory to make the HUD button visible on player load
|
||||||
|
|||||||
@@ -309,6 +309,9 @@ func leave_room() -> void:
|
|||||||
kick_all_clients.rpc()
|
kick_all_clients.rpc()
|
||||||
|
|
||||||
# Important: Reset all lobby settings and player lists first
|
# Important: Reset all lobby settings and player lists first
|
||||||
|
Engine.time_scale = 1.0
|
||||||
|
if get_node_or_null("/root/GoalsCycleManager"):
|
||||||
|
get_node("/root/GoalsCycleManager").reset()
|
||||||
reset()
|
reset()
|
||||||
_stop_lan_broadcast()
|
_stop_lan_broadcast()
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
const SafeNakamaMultiplayerBridge = preload("res://scripts/services/safe_nakama_multiplayer_bridge.gd")
|
||||||
|
|
||||||
# Standard Nakama Configuration
|
# Standard Nakama Configuration
|
||||||
var nakama_server_key = OS.get_environment("NAKAMA_SERVER_KEY") if OS.has_environment("NAKAMA_SERVER_KEY") else ProjectSettings.get_setting("network/nakama/server_key", "defaultkey")
|
var nakama_server_key = OS.get_environment("NAKAMA_SERVER_KEY") if OS.has_environment("NAKAMA_SERVER_KEY") else ProjectSettings.get_setting("network/nakama/server_key", "defaultkey")
|
||||||
var nakama_host = OS.get_environment("NAKAMA_HOST") if OS.has_environment("NAKAMA_HOST") else ProjectSettings.get_setting("network/nakama/host", "tektondash.vps.webdock.cloud")
|
var nakama_host = OS.get_environment("NAKAMA_HOST") if OS.has_environment("NAKAMA_HOST") else ProjectSettings.get_setting("network/nakama/host", "tektondash.vps.webdock.cloud")
|
||||||
@@ -141,7 +143,7 @@ func connect_to_nakama_async(email: String = "", password: String = "") -> bool:
|
|||||||
bridge.leave()
|
bridge.leave()
|
||||||
bridge = null
|
bridge = null
|
||||||
|
|
||||||
bridge = NakamaMultiplayerBridge.new(socket)
|
bridge = SafeNakamaMultiplayerBridge.new(socket)
|
||||||
|
|
||||||
# Connect bridge signals
|
# Connect bridge signals
|
||||||
bridge.match_joined.connect(_on_bridge_match_joined)
|
bridge.match_joined.connect(_on_bridge_match_joined)
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
class_name SafeNakamaMultiplayerBridge
|
||||||
|
extends NakamaMultiplayerBridge
|
||||||
|
|
||||||
|
func _init(p_nakama_socket: NakamaSocket) -> void:
|
||||||
|
super._init(p_nakama_socket)
|
||||||
|
|
||||||
|
func _map_id_to_session(peer_id: int, session_id: String) -> void:
|
||||||
|
_id_map[peer_id] = session_id
|
||||||
|
if not _users.has(session_id):
|
||||||
|
_users[session_id] = NakamaMultiplayerBridge.User.new(null)
|
||||||
|
_users[session_id].peer_id = peer_id
|
||||||
|
|
||||||
|
func _on_multiplayer_peer_packet_generated(peer_id: int, buffer: PackedByteArray) -> void:
|
||||||
|
if match_state == MatchState.CONNECTED:
|
||||||
|
var target_presences = null
|
||||||
|
if peer_id > 0:
|
||||||
|
if not _id_map.has(peer_id) or not _users.has(_id_map[peer_id]) or _users[_id_map[peer_id]].presence == null:
|
||||||
|
push_error("Attempting to send RPC to unknown or uninitialized peer id: %s" % peer_id)
|
||||||
|
return
|
||||||
|
target_presences = [ _users[_id_map[peer_id]].presence ]
|
||||||
|
_nakama_socket.send_match_state_raw_async(_match_id, rpc_op_code, buffer, target_presences)
|
||||||
|
else:
|
||||||
|
push_error("RPC sent while the NakamaMultiplayerBridge isn't connected!")
|
||||||
Reference in New Issue
Block a user