diff --git a/addons/enhanced_gridmap/meshlibrary/default.tres b/addons/enhanced_gridmap/meshlibrary/default.tres index ae52807..64211ef 100644 --- a/addons/enhanced_gridmap/meshlibrary/default.tres +++ b/addons/enhanced_gridmap/meshlibrary/default.tres @@ -8,9 +8,9 @@ [ext_resource type="ArrayMesh" uid="uid://bqvqj3fhf5x51" path="res://assets/models/tiles/tile_ghost.tres" id="6_r32il"] [ext_resource type="ArrayMesh" uid="uid://cv4bedhida00g" path="res://assets/models/tiles/tile_star.tres" id="7_p5epg"] [ext_resource type="ArrayMesh" uid="uid://gpnl4cjrivor" path="res://assets/models/tiles/tile_speed.tres" id="7_sx8rm"] +[ext_resource type="ArrayMesh" uid="uid://bfv8cw1vho5p5" path="res://assets/models/meshes/ancient_lightning_stones.res" id="8_cg50n"] [ext_resource type="BoxMesh" uid="uid://fy4bhoeii40c" path="res://addons/enhanced_gridmap/meshlibrary/tile_safe_zone.tres" id="8_uwjsj"] [ext_resource type="BoxMesh" uid="uid://dy5p77cjb3geo" path="res://addons/enhanced_gridmap/meshlibrary/tile_start.tres" id="9_pgnbl"] -[ext_resource type="BoxMesh" uid="uid://dcjdwbffgtutt" path="res://addons/enhanced_gridmap/meshlibrary/tile_non_walkable.tres" id="10_pgnbl"] [ext_resource type="Texture2D" uid="uid://dpkx1a780pvwv" path="res://assets/textures/tile_diamond.png" id="10_sx8rm"] [ext_resource type="BoxMesh" uid="uid://b5cc3prem52r6" path="res://addons/enhanced_gridmap/meshlibrary/tile_freeze.tres" id="11_pgnbl"] @@ -110,7 +110,6 @@ item/3/shapes = [] item/3/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) item/3/navigation_layers = 1 item/4/name = "non-walkable" -item/4/mesh = ExtResource("10_pgnbl") item/4/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) item/4/mesh_cast_shadow = 1 item/4/shapes = [] @@ -186,3 +185,10 @@ item/14/mesh_cast_shadow = 1 item/14/shapes = [] item/14/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) item/14/navigation_layers = 1 +item/15/name = "Ancient Lightning Stones" +item/15/mesh = ExtResource("8_cg50n") +item/15/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) +item/15/mesh_cast_shadow = 1 +item/15/shapes = [] +item/15/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) +item/15/navigation_layers = 1 diff --git a/assets/graphics/level_bg/level_bg_colloseum.jpg b/assets/graphics/level_bg/level_bg_colloseum.jpg new file mode 100644 index 0000000..07682b5 Binary files /dev/null and b/assets/graphics/level_bg/level_bg_colloseum.jpg differ diff --git a/assets/graphics/level_bg/level_bg_colloseum.jpg.import b/assets/graphics/level_bg/level_bg_colloseum.jpg.import new file mode 100644 index 0000000..dee507f --- /dev/null +++ b/assets/graphics/level_bg/level_bg_colloseum.jpg.import @@ -0,0 +1,41 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://u6igejwdutv1" +path.s3tc="res://.godot/imported/level_bg_colloseum.jpg-ea8a2c73325905e650d57c2e50e0d1bc.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/graphics/level_bg/level_bg_colloseum.jpg" +dest_files=["res://.godot/imported/level_bg_colloseum.jpg-ea8a2c73325905e650d57c2e50e0d1bc.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/assets/models/Textures/4e3103ab214e443c83147afcd786aa6e_RGB_M_Buche_albedo.jpeg b/assets/models/Textures/4e3103ab214e443c83147afcd786aa6e_RGB_M_Buche_albedo.jpeg new file mode 100644 index 0000000..b177c3d Binary files /dev/null and b/assets/models/Textures/4e3103ab214e443c83147afcd786aa6e_RGB_M_Buche_albedo.jpeg differ diff --git a/assets/models/Textures/4e3103ab214e443c83147afcd786aa6e_RGB_M_Buche_albedo.jpeg.import b/assets/models/Textures/4e3103ab214e443c83147afcd786aa6e_RGB_M_Buche_albedo.jpeg.import new file mode 100644 index 0000000..0981605 --- /dev/null +++ b/assets/models/Textures/4e3103ab214e443c83147afcd786aa6e_RGB_M_Buche_albedo.jpeg.import @@ -0,0 +1,41 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cunm3fe2utrsy" +path.s3tc="res://.godot/imported/4e3103ab214e443c83147afcd786aa6e_RGB_M_Buche_albedo.jpeg-69394e445366683380463d4afc846305.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/models/Textures/4e3103ab214e443c83147afcd786aa6e_RGB_M_Buche_albedo.jpeg" +dest_files=["res://.godot/imported/4e3103ab214e443c83147afcd786aa6e_RGB_M_Buche_albedo.jpeg-69394e445366683380463d4afc846305.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/assets/models/ancient-lightning-stones.tres b/assets/models/ancient-lightning-stones.tres new file mode 100644 index 0000000..3953676 --- /dev/null +++ b/assets/models/ancient-lightning-stones.tres @@ -0,0 +1,7 @@ +[gd_resource type="StandardMaterial3D" format=3 uid="uid://deufkavgeo0jg"] + +[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_ywepx"] +load_path = "res://.godot/imported/4e3103ab214e443c83147afcd786aa6e_RGB_M_Buche_albedo.jpeg-69394e445366683380463d4afc846305.s3tc.ctex" + +[resource] +albedo_texture = SubResource("CompressedTexture2D_ywepx") diff --git a/assets/models/meshes/ancient_lightning_stone.mtl b/assets/models/meshes/ancient_lightning_stone.mtl new file mode 100644 index 0000000..c934b9f --- /dev/null +++ b/assets/models/meshes/ancient_lightning_stone.mtl @@ -0,0 +1,12 @@ +# Blender 5.0.1 MTL File: 'quit.blend' +# www.blender.org + +newmtl Material.001 +Ns 250.000000 +Ka 1.000000 1.000000 1.000000 +Ks 0.500000 0.500000 0.500000 +Ke 0.000000 0.000000 0.000000 +Ni 1.500000 +d 1.000000 +illum 2 +map_Kd C:/Users/beng/Downloads/3d_Ripper_Pro_v103/Downloads/SarahMyriamMadi/01- Handpainted.Log/4e3103ab214e443c83147afcd786aa6e_RGB_M_Buche_albedo.jpeg diff --git a/assets/models/meshes/ancient_lightning_stone.obj b/assets/models/meshes/ancient_lightning_stone.obj new file mode 100644 index 0000000..19e4afc --- /dev/null +++ b/assets/models/meshes/ancient_lightning_stone.obj @@ -0,0 +1,34 @@ +# Blender 5.0.1 +# www.blender.org +mtllib ancient_lightning_stone.mtl +o Cube +v -0.500000 0.001070 0.500000 +v -0.500000 0.201070 0.500000 +v -0.500000 0.001070 -0.500000 +v -0.500000 0.201070 -0.500000 +v 0.500000 0.001070 0.500000 +v 0.500000 0.201070 0.500000 +v 0.500000 0.001070 -0.500000 +v 0.500000 0.201070 -0.500000 +vn -1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 -1.0000 +vn 1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 1.0000 +vn -0.0000 -1.0000 -0.0000 +vn -0.0000 1.0000 -0.0000 +vt 0.041259 0.022396 +vt 0.145314 0.022396 +vt 0.145314 0.286889 +vt 0.041259 0.286889 +vt 0.383323 0.184104 +vt 0.249490 0.184104 +vt 0.249490 0.050271 +vt 0.383323 0.050271 +s 0 +usemtl Material.001 +f 1/1/1 2/2/1 4/3/1 3/4/1 +f 3/1/2 4/2/2 8/3/2 7/4/2 +f 7/1/3 8/2/3 6/3/3 5/4/3 +f 5/1/4 6/2/4 2/3/4 1/4/4 +f 3/5/5 7/6/5 5/7/5 1/8/5 +f 8/5/6 4/6/6 2/7/6 6/8/6 diff --git a/assets/models/meshes/ancient_lightning_stone.obj.import b/assets/models/meshes/ancient_lightning_stone.obj.import new file mode 100644 index 0000000..f36f498 --- /dev/null +++ b/assets/models/meshes/ancient_lightning_stone.obj.import @@ -0,0 +1,25 @@ +[remap] + +importer="wavefront_obj" +importer_version=1 +type="Mesh" +uid="uid://c5dhg8hrvx8au" +path="res://.godot/imported/ancient_lightning_stone.obj-128ba3478bbc9a63b53917a60bbaf172.mesh" + +[deps] + +files=["res://.godot/imported/ancient_lightning_stone.obj-128ba3478bbc9a63b53917a60bbaf172.mesh"] + +source_file="res://assets/models/meshes/ancient_lightning_stone.obj" +dest_files=["res://.godot/imported/ancient_lightning_stone.obj-128ba3478bbc9a63b53917a60bbaf172.mesh", "res://.godot/imported/ancient_lightning_stone.obj-128ba3478bbc9a63b53917a60bbaf172.mesh"] + +[params] + +generate_tangents=true +generate_lods=true +generate_shadow_mesh=true +generate_lightmap_uv2=false +generate_lightmap_uv2_texel_size=0.2 +scale_mesh=Vector3(1, 1, 1) +offset_mesh=Vector3(0, 0, 0) +force_disable_mesh_compression=false diff --git a/assets/models/meshes/ancient_lightning_stones.res b/assets/models/meshes/ancient_lightning_stones.res new file mode 100644 index 0000000..8bf911f Binary files /dev/null and b/assets/models/meshes/ancient_lightning_stones.res differ diff --git a/assets/models/meshes/ancient_lightning_stones.tres b/assets/models/meshes/ancient_lightning_stones.tres new file mode 100644 index 0000000..31e8854 --- /dev/null +++ b/assets/models/meshes/ancient_lightning_stones.tres @@ -0,0 +1,34 @@ +[gd_resource type="ArrayMesh" format=4 uid="uid://dwif2e63pfrp3"] + +[ext_resource type="Material" uid="uid://deufkavgeo0jg" path="res://assets/models/ancient-lightning-stones.tres" id="1_6ovj8"] + +[sub_resource type="ArrayMesh" id="ArrayMesh_hoqx8"] +_surfaces = [{ +"aabb": AABB(-0.5, 0.00107, -0.5, 1, 0.2, 1), +"format": 34896613377, +"index_count": 36, +"index_data": PackedByteArray("AAABAAIAAgABAAMAAAAEAAEABAADAAEAAgAFAAAAAgADAAUABgAEAAAAAAAFAAYABwADAAQABQADAAcABgAHAAQABQAHAAYA"), +"name": "Material", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 8, +"vertex_data": PackedByteArray("AAD/////AAAAAAAA//8AAAAA//8AAAAAAAAAAAAAAAD//wAA//8AAP////8AAAAA////////AAD//wAAAAAAAA==") +}] +blend_shape_mode = 0 + +[resource] +_surfaces = [{ +"aabb": AABB(-0.5, 0.00107, -0.5, 1, 0.2, 1), +"attribute_data": PackedByteArray("MyVD+o8KQ/ozJY22jwqNtjMlQ/qPCkP6MyWNto8KjbYzJUP6jwpD+jMljbaPCo22MyVD+o8KQ/ozJY22jwqNtt4/3dAhYt3Q3j8g8yFiIPPeP93QIWLd0N4/IPMhYiDz"), +"format": 34896613399, +"index_count": 36, +"index_data": PackedByteArray("AAABAAIAAgABAAMABAAFAAYABgAFAAcACAAJAAoACgAJAAsADAANAA4ADgANAA8AEAARABIAEgARABMAFAAVABYAFgAVABcA"), +"material": ExtResource("1_6ovj8"), +"name": "Material", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 24, +"vertex_data": PackedByteArray("AAD/////VNUAAAAA//9U1QAA//8AAFTVAAAAAAAAVNUAAP//AAD//wAAAAAAAP///////wAA/////wAAAAD///////8AAFTV//8AAAAAVNX///////9U1f//AAD//1TV/////////7///wAA////vwAA//////+/AAAAAP///7///wAAAAD//wAAAAAAAP////8AAP////8AAAAA/////wAA//8AAP+//////wAA/78AAP//////v/////////+/VNVU1VTVVNVU1VTVVNVU1f+//7//v/+//7//v/+//7+qKqoqqiqqKqoqqiqqKqoq//////////////////////9//z//f/8//3//P/9//z////9/////f////3////9/") +}] +blend_shape_mode = 0 +shadow_mesh = SubResource("ArrayMesh_hoqx8") diff --git a/assets/models/meshes/tiles.res b/assets/models/meshes/tiles.res index a6ff67d..a1f665c 100644 Binary files a/assets/models/meshes/tiles.res and b/assets/models/meshes/tiles.res differ diff --git a/project.godot b/project.godot index b6032df..ae2ba93 100644 --- a/project.godot +++ b/project.godot @@ -21,6 +21,7 @@ config/icon="res://icon.svg" [autoload] +SettingsManager="*uid://c1ouaaqnn0lrc" Nakama="*uid://bueyqhhvxe0tx" NakamaManager="*res://scripts/nakama_manager.gd" AuthManager="*res://scripts/managers/auth_manager.gd" @@ -32,7 +33,6 @@ GoalManager="*res://scripts/managers/goal_manager.gd" PlayerManager="*res://scripts/managers/player_manager.gd" GoalsCycleManager="*res://scripts/managers/goals_cycle_manager.gd" Satori="*uid://b8vev00s34b7" -SettingsManager="*uid://c1ouaaqnn0lrc" [display] @@ -69,28 +69,24 @@ move_north={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":87,"physical_keycode":0,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) -, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null) ] } move_south={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":83,"physical_keycode":0,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) -, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null) ] } move_west={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":65,"physical_keycode":0,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) -, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null) ] } move_east={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":68,"physical_keycode":0,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) -, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null) ] } move_northeast={ diff --git a/scenes/main.gd b/scenes/main.gd index 5907dbf..70fad54 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -61,6 +61,9 @@ func _ready(): # Setup global multiplayer spawners (Stands, etc.) _setup_multiplayer_spawners() + # Apply Arena Background + _apply_arena_background() + # HUD Settings connection is now handled internally by TouchControlsManager # which calls _toggle_pause_menu() on this scene. @@ -86,6 +89,31 @@ func _setup_multiplayer_spawners(): stand_spawner.add_spawnable_scene("res://scenes/static_tekton_stand.tscn") add_child(stand_spawner) +func _apply_arena_background(): + var arena_bg = get_node_or_null("ArenaBG") + if not arena_bg: + return + + var selected_area = LobbyManager.get_selected_area() + var texture_path = "" + + match selected_area: + "Colloseum": + texture_path = "res://assets/graphics/level_bg/level_bg_colloseum.jpg" + "Stop N Go Arena": + texture_path = "res://assets/graphics/level_bg/placeholder_stop_n_go.jpg" + "Tekton Doors Arena": + texture_path = "res://assets/graphics/level_bg/placeholder_tekton_doors.jpg" + "Classic", _: + texture_path = "res://assets/graphics/level_bg/placeholder_classic.jpg" + + if ResourceLoader.exists(texture_path): + var tex = load(texture_path) + if tex: + arena_bg.texture = tex + else: + print("Arena bg texture not found: ", texture_path) + @rpc("any_peer", "call_local", "reliable") func sync_portal_configs(configs: Array): if portal_mode_manager: @@ -2082,9 +2110,10 @@ func _on_back_to_menu_pressed(): """Return to lobby/main menu and clean up game state.""" print("[Main] Returning to lobby...") - # Clean up game state + # Proper ordered cleanup to avoid ghost players GameStateManager.end_game() LobbyManager.reset() + # Properly disconnect from Nakama match _cleanup_multiplayer() diff --git a/scenes/main.tscn b/scenes/main.tscn index c0230e9..96ff0ae 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -33,6 +33,7 @@ [ext_resource type="Texture2D" uid="uid://ckhdyxnho6sjp" path="res://assets/graphics/touch_control/spawn_tile.png" id="28_j8jky"] [ext_resource type="Texture2D" uid="uid://b2vhatfmufn3d" path="res://assets/graphics/touch_control/ghost.png" id="33_5q0nq"] [ext_resource type="Texture2D" uid="uid://biun2yvglxgij" path="res://assets/graphics/touch_control/grab_tekton.png" id="36_pibwh"] +[ext_resource type="Texture2D" uid="uid://u6igejwdutv1" path="res://assets/graphics/level_bg/level_bg_colloseum.jpg" id="37_fuf3a"] [ext_resource type="Script" uid="uid://86ikh0wuqk7v" path="res://scripts/ui/powerup_inventory_ui.gd" id="powerup_ui_script"] [ext_resource type="Script" uid="uid://b54tfa0n6kogi" path="res://scripts/managers/touch_controls.gd" id="touch_manager"] [ext_resource type="Script" uid="uid://djiml4sh61dc1" path="res://scripts/ui/virtual_joystick.gd" id="virtual_joystick"] @@ -101,7 +102,7 @@ auto_randomize = true start_item = 2 end_item = 3 immutable_items = Array[int]([4]) -metadata/_editor_floor_ = Vector3(0, 1, 0) +metadata/_editor_floor_ = Vector3(0, 0, 0) [node name="Camera3D" type="Camera3D" parent="." unique_id=1200003163] transform = Transform3D(1, 0, 0, 0, 0.422618, 0.906308, 0, -0.906308, 0.422618, 7, 22.925, 18.4489) @@ -10212,6 +10213,11 @@ custom_minimum_size = Vector2(0, 40) layout_mode = 2 text = "Back" +[node name="ArenaBG" type="Sprite3D" parent="." unique_id=2070634860] +transform = Transform3D(4, 0, 0, 0, 1.8291987, 3.557251, 0, -3.557251, 1.8291987, 6.109789, -30, -4) +texture = ExtResource("37_fuf3a") +region_rect = Rect2(0, 0, 1080, 0) + [connection signal="pressed" from="Menu/Host" to="." method="_on_host_pressed"] [connection signal="pressed" from="Menu/Join" to="." method="_on_join_pressed"] [connection signal="text_submitted" from="MessageInput" to="." method="_on_message_input_text_submitted"] diff --git a/scripts/managers/auth_manager.gd b/scripts/managers/auth_manager.gd index 68bd020..afe1c09 100644 --- a/scripts/managers/auth_manager.gd +++ b/scripts/managers/auth_manager.gd @@ -358,8 +358,8 @@ func link_google(id_token: String) -> bool: func logout() -> void: print("[AuthManager] Logging out...") - if NakamaManager.socket: - NakamaManager.socket.close() + # FULL CLEANUP: close socket, leave bridge, clear multiplayer peer + NakamaManager.cleanup() clear_session() diff --git a/scripts/managers/game_state_manager.gd b/scripts/managers/game_state_manager.gd index 8b43449..9005aaa 100644 --- a/scripts/managers/game_state_manager.gd +++ b/scripts/managers/game_state_manager.gd @@ -50,3 +50,4 @@ func reset(): bots.clear() game_started_flag = false local_player_character = null + emit_signal("game_state_changed") diff --git a/scripts/managers/lobby_manager.gd b/scripts/managers/lobby_manager.gd index 5242417..22f4614 100644 --- a/scripts/managers/lobby_manager.gd +++ b/scripts/managers/lobby_manager.gd @@ -40,9 +40,9 @@ signal scarcity_mode_changed(mode: String) # Character and area selection var available_characters: Array[String] = ["Copper", "Dabro", "Gatot", "Pip", "Random"] -var available_areas: Array[String] = ["Desert", "Forest", "City", "Factory"] +var available_areas: Array[String] = [] var available_game_modes: Array[String] = ["Freemode", "Stop n Go", "Tekton Doors"] -var selected_area: String = "Desert" # Host-controlled +var selected_area: String = "Classic" # Host-controlled var game_mode: String = "Freemode" # Host-controlled var local_character_index: int = 0 # Local player's character index @@ -59,11 +59,24 @@ signal game_mode_changed(mode: String) var _all_ready: bool = false func _ready(): + _update_available_areas(game_mode) + # Connect to Nakama signals NakamaManager.match_joined.connect(_on_match_joined) multiplayer.peer_connected.connect(_on_peer_connected) multiplayer.peer_disconnected.connect(_on_peer_disconnected) +func _update_available_areas(mode: String) -> void: + match mode: + "Freemode": + available_areas = ["Classic", "Colloseum"] + "Stop n Go": + available_areas = ["Stop N Go Arena"] + "Tekton Doors": + available_areas = ["Tekton Doors Arena"] + _: + available_areas = ["Classic"] + # ============================================================================= # Room Creation / Joining # ============================================================================= @@ -106,6 +119,9 @@ func leave_room() -> void: # Disconnect from Nakama match if NakamaManager.socket: NakamaManager.socket.close() + + # Important: Clean up game state as well to prevent ghost players + GameStateManager.reset() emit_signal("room_left") @@ -384,11 +400,16 @@ func set_game_mode(mode: String) -> void: game_mode = mode rpc("sync_game_mode", mode) + + _update_available_areas(mode) + if selected_area not in available_areas: + set_area(available_areas[0]) @rpc("authority", "call_local", "reliable") func sync_game_mode(mode: String) -> void: """Sync game mode selection from host to clients.""" game_mode = mode + _update_available_areas(mode) emit_signal("game_mode_changed", mode) func start_game() -> void: @@ -540,7 +561,8 @@ func reset() -> void: is_host = false _all_ready = false match_duration = 180 # Reset to default 3 minutes - selected_area = "Desert" + game_mode = "Freemode" + _update_available_areas(game_mode) + selected_area = available_areas[0] local_character_index = 0 # Default to "Copper" enable_cycle_timer = false - game_mode = "Freemode" diff --git a/scripts/managers/stop_n_go_manager.gd b/scripts/managers/stop_n_go_manager.gd index 290fe8e..1f1e71f 100644 --- a/scripts/managers/stop_n_go_manager.gd +++ b/scripts/managers/stop_n_go_manager.gd @@ -46,6 +46,7 @@ const TILE_START = 3 # Start Line const TILE_FINISH = 3 # Finish Line const TILE_SAFE = 2 # Green Safe Zone const TILE_OBSTACLE = 4 # Wall +const TILE_LIGHTNING_STONE = 15 # Ancient Rock with Lightning Symbol var hud_layer: CanvasLayer var mission_label: Label @@ -709,8 +710,8 @@ func _spawn_powerup_tiles(): for i in range(PERMANENT_POWERUP_LOCATIONS.size()): var pos = PERMANENT_POWERUP_LOCATIONS[i] - # Set Floor 0 beneath power-up to ID 1 (Hover pattern) - Static PADS - gridmap.set_cell_item(Vector3i(pos.x, 0, pos.y), 1) + # Set Floor 0 beneath power-up to ID 15 (Ancient Lightning Stone) + gridmap.set_cell_item(Vector3i(pos.x, 0, pos.y), TILE_LIGHTNING_STONE) # Cycle through the available power-up types var tile_id = POWERUP_TILES[i % POWERUP_TILES.size()] @@ -720,7 +721,7 @@ func _spawn_powerup_tiles(): # Sync both floor and tile to all clients and host if can_rpc(): - main.rpc("sync_grid_item", pos.x, 0, pos.y, 1) # Sync floor change (Pad on) + main.rpc("sync_grid_item", pos.x, 0, pos.y, TILE_LIGHTNING_STONE) # Sync floor change (Stone on) main.rpc("sync_grid_item", pos.x, 1, pos.y, tile_id) # Sync power-up powerups_spawned = true