From 3f3136c453253c4bfcb527620fa20360ce392c3b Mon Sep 17 00:00:00 2001 From: null Date: Tue, 12 May 2026 16:52:57 -0500 Subject: [PATCH 1/3] Update GEMINI documentation to reflect Godot 4.6 and expanded project structure --- GEMINI.md | 6 +++--- game/GEMINI.md | 15 ++++++++++++--- microservices/GEMINI.md | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/GEMINI.md b/GEMINI.md index e99309c..1d5d5c2 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -4,8 +4,8 @@ This project is a multi-layered application consisting of a Godot-based game and ## Project Structure -- `game/`: The Godot 4.5 game project. -- `microservices/`: ASP.NET Core 8.0 microservices providing backend logic (Auth, Character, Inventory, Locations, etc.). +- `game/`: The Godot 4.6 game project. +- `microservices/`: ASP.NET Core 8.0 microservices providing backend logic (Auth, Character, Crafting, Inventory, Locations, Mail, and World). - `.gitea/workflows/`: CI/CD pipelines for deploying microservices to Kubernetes. ## Core Mandates @@ -17,7 +17,7 @@ This project is a multi-layered application consisting of a Godot-based game and ## Getting Started - **Microservices**: Each microservice can be run individually or via the `micro-services.sln` solution file. They require a MongoDB instance (default: `mongodb://127.0.0.1:27017`). -- **Game**: Open `game/project.godot` in Godot Engine 4.5+. +- **Game**: Open `game/project.godot` in Godot Engine 4.6+. ## Shared Conventions diff --git a/game/GEMINI.md b/game/GEMINI.md index 9ee3090..1ead371 100644 --- a/game/GEMINI.md +++ b/game/GEMINI.md @@ -1,10 +1,10 @@ # Godot Game Development - GEMINI.md -This directory contains the Godot 4.5 game project for "Promiscuity". +This directory contains the Godot 4.6 game project for "Promiscuity". ## Core Mandates -- **Engine Version**: Godot 4.5 (Forward Plus). +- **Engine Version**: Godot 4.6 (Forward Plus). - **Language**: GDScript is the primary scripting language. C# is enabled but used only when performance or specific library needs arise. - **Naming Conventions**: - Files/Folders: `snake_case.gd`, `snake_case.tscn`. @@ -14,8 +14,12 @@ This directory contains the Godot 4.5 game project for "Promiscuity". - **Autoloads**: Use the established singletons for global state and services: - `AuthState`: JWT authentication and session. - `CharacterService`: API calls for character management. + - `SelectedCharacter`: Tracking the currently active character. - `QuestManager`: Game quest progression. - `DialogSystem`: UI dialog and interaction. + - `TeleportState`: Handling transitions between levels. + - `MenuMusic` / `MenuSfx`: Audio management. + - `SimpleGrass`: Singleton for grass rendering. - **Node Paths**: Prefer `unique names` (%NodeName) or `@onready` variables for node references. Avoid fragile string paths. ## Asset Pipeline @@ -30,8 +34,13 @@ This directory contains the Godot 4.5 game project for "Promiscuity". - `Characters/`: Player and NPC scenes. - `Levels/`: Game world/environments. - `UI/`: Menus, HUDs, and UI components. + - `Interaction/`: Interactive objects and systems (e.g., RadialCommandMenu). + - `Projectiles/`: Projectiles like fireballs. + - `Quests/`: Quest-related scenes and logic. + - `Vehicles/`: Controllable vehicles. + - `CardGame/`: Minigame components. - `assets/`: Raw assets (textures, models, audio). -- `addons/`: Third-party plugins (e.g., `simplegrasstextured`). +- `addons/`: Third-party plugins (e.g., `simplegrasstextured`, `godot_mcp`). ## Best Practices diff --git a/microservices/GEMINI.md b/microservices/GEMINI.md index caa2043..2cfebb8 100644 --- a/microservices/GEMINI.md +++ b/microservices/GEMINI.md @@ -39,4 +39,4 @@ Each microservice follows a standard layout: - Update `DOCUMENTS.md` whenever you change a database schema or API request/response shape. - Ensure `Dockerfile` and `k8s/` manifests are kept in sync with code changes. -- All microservices are unified under the `micro-services.sln` solution file. +- All microservices are unified under the `micro-services.sln` solution file. Use this for global refactoring or cross-service debugging. From 2907fabe851d76e7d8b69e0db6c107de42638f74 Mon Sep 17 00:00:00 2001 From: null Date: Tue, 12 May 2026 17:06:23 -0500 Subject: [PATCH 2/3] feat: add spreading mushroom to playground level --- game/scenes/Interaction/mushroom.gd | 75 +++++++++++++++++++++++++ game/scenes/Interaction/mushroom.gd.uid | 1 + game/scenes/Interaction/mushroom.tscn | 40 +++++++++++++ game/scenes/Levels/level.tscn | 66 +++++++--------------- 4 files changed, 135 insertions(+), 47 deletions(-) create mode 100644 game/scenes/Interaction/mushroom.gd create mode 100644 game/scenes/Interaction/mushroom.gd.uid create mode 100644 game/scenes/Interaction/mushroom.tscn diff --git a/game/scenes/Interaction/mushroom.gd b/game/scenes/Interaction/mushroom.gd new file mode 100644 index 0000000..0803236 --- /dev/null +++ b/game/scenes/Interaction/mushroom.gd @@ -0,0 +1,75 @@ +extends Node3D + +@export var spread_radius := 2.0 +@export var spread_interval_min := 5.0 +@export var spread_interval_max := 15.0 +@export var max_mushrooms_in_radius := 3 +@export var check_radius := 1.5 +@export var max_total_mushrooms := 50 + +static var total_mushrooms := 0 + +@onready var spread_timer: Timer = $SpreadTimer +@onready var ground_ray: RayCast3D = $GroundRay + +func _ready() -> void: + total_mushrooms += 1 + _setup_timer() + + # Randomize initial scale for variety + scale = Vector3.ONE * randf_range(0.8, 1.2) + rotation.y = randf_range(0, TAU) + +func _setup_timer() -> void: + spread_timer.wait_time = randf_range(spread_interval_min, spread_interval_max) + spread_timer.start() + +func _on_spread_timer_timeout() -> void: + if total_mushrooms >= max_total_mushrooms: + return + + if _count_nearby_mushrooms() >= max_mushrooms_in_radius: + # Too crowded, try again later + _setup_timer() + return + + _attempt_spread() + _setup_timer() + +func _attempt_spread() -> void: + var random_angle := randf_range(0, TAU) + var random_dist := randf_range(spread_radius * 0.5, spread_radius) + var offset := Vector3(cos(random_angle) * random_dist, 5.0, sin(random_angle) * random_dist) + + ground_ray.position = offset + ground_ray.force_raycast_update() + + if ground_ray.is_colliding(): + var collision_point := ground_ray.get_collision_point() + var collision_normal := ground_ray.get_collision_normal() + + # Only spread on relatively flat surfaces + if collision_normal.dot(Vector3.UP) > 0.7: + _spawn_mushroom(collision_point) + +func _spawn_mushroom(pos: Vector3) -> void: + var mushroom_scene = load(scene_file_path) + var new_mushroom = mushroom_scene.instantiate() + get_parent().add_child(new_mushroom) + new_mushroom.global_position = pos + + # Visual feedback/animation + new_mushroom.scale = Vector3.ZERO + var tween = create_tween() + tween.tween_property(new_mushroom, "scale", Vector3.ONE * randf_range(0.8, 1.2), 1.0).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT) + +func _count_nearby_mushrooms() -> int: + var count := 0 + for mushroom in get_tree().get_nodes_in_group("mushrooms"): + if mushroom == self: continue + if global_position.distance_to(mushroom.global_position) < check_radius: + count += 1 + return count + +func _exit_tree() -> void: + total_mushrooms -= 1 diff --git a/game/scenes/Interaction/mushroom.gd.uid b/game/scenes/Interaction/mushroom.gd.uid new file mode 100644 index 0000000..f2fd566 --- /dev/null +++ b/game/scenes/Interaction/mushroom.gd.uid @@ -0,0 +1 @@ +uid://brtwt4rp650ao diff --git a/game/scenes/Interaction/mushroom.tscn b/game/scenes/Interaction/mushroom.tscn new file mode 100644 index 0000000..58fef27 --- /dev/null +++ b/game/scenes/Interaction/mushroom.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=6 format=3] + +[ext_resource type="Script" path="res://scenes/Interaction/mushroom.gd" id="1_m1s2h"] + +[sub_resource type="CylinderMesh" id="CylinderMesh_stem"] +top_radius = 0.05 +bottom_radius = 0.05 +height = 0.15 + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_stem"] +albedo_color = Color(0.9, 0.85, 0.7, 1) + +[sub_resource type="SphereMesh" id="SphereMesh_cap"] +radius = 0.15 +height = 0.1 +is_hemisphere = true + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cap"] +albedo_color = Color(0.8, 0.2, 0.2, 1) + +[node name="Mushroom" type="Node3D" groups=["mushrooms"]] +script = ExtResource("1_m1s2h") + +[node name="Stem" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.075, 0) +mesh = SubResource("CylinderMesh_stem") +surface_material_override/0 = SubResource("StandardMaterial3D_stem") + +[node name="Cap" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.15, 0) +mesh = SubResource("SphereMesh_cap") +surface_material_override/0 = SubResource("StandardMaterial3D_cap") + +[node name="SpreadTimer" type="Timer" parent="."] +one_shot = true + +[node name="GroundRay" type="RayCast3D" parent="."] +target_position = Vector3(0, -10, 0) + +[connection signal="timeout" from="SpreadTimer" to="." method="_on_spread_timer_timeout"] diff --git a/game/scenes/Levels/level.tscn b/game/scenes/Levels/level.tscn index 26155a7..4aa1999 100644 --- a/game/scenes/Levels/level.tscn +++ b/game/scenes/Levels/level.tscn @@ -5,10 +5,7 @@ [ext_resource type="Script" uid="uid://bpxggc8nr6tf6" path="res://scenes/player.gd" id="1_muv8p"] [ext_resource type="PackedScene" uid="uid://c5of6aaxop1hl" path="res://scenes/block.tscn" id="2_tc7dm"] [ext_resource type="PackedScene" uid="uid://dp6jk0k3o4v1u" path="res://scenes/UI/pause_menu.tscn" id="3_pause_menu"] -[ext_resource type="PackedScene" path="res://scenes/Vehicles/car.tscn" id="5_car"] [ext_resource type="PackedScene" uid="uid://bnqaqbgynoyys" path="res://assets/models/TestCharAnimated.glb" id="5_fi66n"] -[ext_resource type="Script" uid="uid://bk53njt7i3kmv" path="res://scenes/Interaction/dialog_trigger_area.gd" id="6_dialog"] -[ext_resource type="Script" uid="uid://cshtdpjp4xy2f" path="res://scenes/Quests/quest_trigger_area.gd" id="7_qtrigger"] [ext_resource type="PackedScene" path="res://scenes/Interaction/prototype_gateway.tscn" id="8_teleporter"] [ext_resource type="Shader" uid="uid://bi3o8elbtqoni" path="res://addons/simplegrasstextured/shaders/grass.gdshader" id="9_43ksg"] [ext_resource type="Material" path="res://assets/materials/kenney_prototype_ground_green.tres" id="9_ground_mat"] @@ -16,6 +13,7 @@ [ext_resource type="Script" uid="uid://2juaclm8gc1n" path="res://addons/simplegrasstextured/grass.gd" id="11_1meta"] [ext_resource type="Texture2D" uid="uid://b2dmnrm3ubjon" path="res://assets/textures/stolenFire.png" id="16_i35yb"] [ext_resource type="PackedScene" uid="uid://bnwpu7p8sbsfa" path="res://scenes/Interaction/RadialCommandMenu.tscn" id="16_px5jg"] +[ext_resource type="PackedScene" path="res://scenes/Interaction/mushroom.tscn" id="17_mushroom"] [sub_resource type="PhysicsMaterial" id="PhysicsMaterial_2q6dc"] bounce = 0.5 @@ -247,34 +245,6 @@ states/Walk/position = Vector2(414, 57) "states/Walk 6/position" = Vector2(516, 402) transitions = ["Idle", "Walk", SubResource("AnimationNodeStateMachineTransition_5qdlo"), "Walk 2", "Idle 2", SubResource("AnimationNodeStateMachineTransition_hwpvo"), "Walk 3", "Run 2", SubResource("AnimationNodeStateMachineTransition_2jvac"), "Run", "Walk 4", SubResource("AnimationNodeStateMachineTransition_m443h"), "Start", "Idle", SubResource("AnimationNodeStateMachineTransition_ccri0"), "Start", "Walk 2", SubResource("AnimationNodeStateMachineTransition_aqwus"), "Start", "Walk 3", SubResource("AnimationNodeStateMachineTransition_tknc3"), "Start", "Run", SubResource("AnimationNodeStateMachineTransition_ygago"), "Idle 3", "Jump 2", SubResource("AnimationNodeStateMachineTransition_koxac"), "Jump", "Idle 4", SubResource("AnimationNodeStateMachineTransition_0pp6t"), "Start", "Jump", SubResource("AnimationNodeStateMachineTransition_3xa5y"), "Start", "Idle 3", SubResource("AnimationNodeStateMachineTransition_8m234"), "Walk", "End", SubResource("AnimationNodeStateMachineTransition_jnqa2"), "Idle 2", "End", SubResource("AnimationNodeStateMachineTransition_vwq6c"), "Run 2", "End", SubResource("AnimationNodeStateMachineTransition_e2sp2"), "Walk 4", "End", SubResource("AnimationNodeStateMachineTransition_r45s2"), "Jump 2", "End", SubResource("AnimationNodeStateMachineTransition_p7els"), "Idle 4", "End", SubResource("AnimationNodeStateMachineTransition_elh2a"), "Start", "Walk 5", SubResource("AnimationNodeStateMachineTransition_bwsrl"), "Walk 5", "Jump 3", SubResource("AnimationNodeStateMachineTransition_dykvg"), "Jump 3", "Walk 6", SubResource("AnimationNodeStateMachineTransition_8m8y3"), "Walk 6", "End", SubResource("AnimationNodeStateMachineTransition_64kfc"), "Start", "Run 3", SubResource("AnimationNodeStateMachineTransition_xdbgi"), "Run 3", "Jump 4", SubResource("AnimationNodeStateMachineTransition_60p50"), "Jump 4", "Run 4", SubResource("AnimationNodeStateMachineTransition_jmoxn"), "Run 4", "End", SubResource("AnimationNodeStateMachineTransition_cvjxp")] -[sub_resource type="SphereShape3D" id="SphereShape3D_dialog_zone"] -radius = 2.5 - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dialog_zone"] -transparency = 1 -cull_mode = 2 -shading_mode = 0 -albedo_color = Color(0.2, 0.8, 0.35, 0.18) - -[sub_resource type="SphereMesh" id="SphereMesh_dialog_zone"] -material = SubResource("StandardMaterial3D_dialog_zone") -radius = 2.5 -height = 5.0 - -[sub_resource type="SphereShape3D" id="SphereShape3D_checkpoint"] -radius = 3.0 - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_checkpoint"] -transparency = 1 -cull_mode = 2 -shading_mode = 0 -albedo_color = Color(1, 0.804, 0.204, 0.2) - -[sub_resource type="SphereMesh" id="SphereMesh_checkpoint"] -material = SubResource("StandardMaterial3D_checkpoint") -radius = 3.0 -height = 6.0 - [sub_resource type="BoxShape3D" id="BoxShape3D_2q6dc"] size = Vector3(1080, 2, 1080) @@ -535,7 +505,6 @@ text = "No active quest." scroll_active = false [node name="RadialCommandMenu" parent="PhoneUI/Control" unique_id=1630028573 instance=ExtResource("16_px5jg")] -layout_mode = 1 [node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1808155101] environment = SubResource("Environment_a4mo8") @@ -546,59 +515,59 @@ target_spawn_name = &"EntrySpawn" quest_event_name = &"entered_car_feature" quest_id_filter = "first_drive" -[node name="Label3D" type="Label3D" parent="CarTeleporter"] +[node name="Label3D" type="Label3D" parent="CarTeleporter" unique_id=664602560] transform = Transform3D(1, 0, 0, 0, 0.965926, -0.258819, 0, 0.258819, 0.965926, 0, 5.4, 0) +pixel_size = 0.012 billboard = 1 no_depth_test = true -pixel_size = 0.012 text = "CAR" -[node name="TriggerZonesTeleporter" parent="." instance=ExtResource("8_teleporter")] +[node name="TriggerZonesTeleporter" parent="." unique_id=1696125782 instance=ExtResource("8_teleporter")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.5, 0, 6) target_scene_path = "res://scenes/Levels/trigger_zones_level.tscn" target_spawn_name = &"EntrySpawn" -[node name="Label3D" type="Label3D" parent="TriggerZonesTeleporter"] +[node name="Label3D" type="Label3D" parent="TriggerZonesTeleporter" unique_id=921277396] transform = Transform3D(1, 0, 0, 0, 0.965926, -0.258819, 0, 0.258819, 0.965926, 0, 5.4, 0) +pixel_size = 0.012 billboard = 1 no_depth_test = true -pixel_size = 0.012 text = "TRIGGERS" -[node name="RepoBotTeleporter" parent="." instance=ExtResource("8_teleporter")] +[node name="RepoBotTeleporter" parent="." unique_id=702675382 instance=ExtResource("8_teleporter")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.5, 0, 12) target_scene_path = "res://scenes/Levels/repo_bot_level.tscn" target_spawn_name = &"EntrySpawn" -[node name="Label3D" type="Label3D" parent="RepoBotTeleporter"] +[node name="Label3D" type="Label3D" parent="RepoBotTeleporter" unique_id=831192951] transform = Transform3D(1, 0, 0, 0, 0.965926, -0.258819, 0, 0.258819, 0.965926, 0, 5.4, 0) +pixel_size = 0.012 billboard = 1 no_depth_test = true -pixel_size = 0.012 text = "REPO BOT" -[node name="AshlingTeleporter" parent="." instance=ExtResource("8_teleporter")] +[node name="AshlingTeleporter" parent="." unique_id=659860279 instance=ExtResource("8_teleporter")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.5, 0, 18) target_scene_path = "res://scenes/Levels/ashling_level.tscn" target_spawn_name = &"EntrySpawn" -[node name="Label3D" type="Label3D" parent="AshlingTeleporter"] +[node name="Label3D" type="Label3D" parent="AshlingTeleporter" unique_id=827154474] transform = Transform3D(1, 0, 0, 0, 0.965926, -0.258819, 0, 0.258819, 0.965926, 0, 5.4, 0) +pixel_size = 0.012 billboard = 1 no_depth_test = true -pixel_size = 0.012 text = "ASHLING" -[node name="CarReturnSpawn" type="Marker3D" parent="."] +[node name="CarReturnSpawn" type="Marker3D" parent="." unique_id=870907294] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.5, 0, -3) -[node name="TriggerZonesReturnSpawn" type="Marker3D" parent="."] +[node name="TriggerZonesReturnSpawn" type="Marker3D" parent="." unique_id=506441986] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.5, 0, 3) -[node name="RepoBotReturnSpawn" type="Marker3D" parent="."] +[node name="RepoBotReturnSpawn" type="Marker3D" parent="." unique_id=1346833855] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.5, 0, 9) -[node name="AshlingReturnSpawn" type="Marker3D" parent="."] +[node name="AshlingReturnSpawn" type="Marker3D" parent="." unique_id=1094551462] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.5, 0, 15) [node name="GPUParticles3D" type="GPUParticles3D" parent="." unique_id=2107882789] @@ -609,4 +578,7 @@ lifetime = 0.9 process_material = SubResource("ParticleProcessMaterial_mwo3k") draw_pass_1 = SubResource("QuadMesh_j43p6") +[node name="Mushroom" parent="." instance=ExtResource("17_mushroom")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, -3.4) + [editable path="Player/TestCharAnimated"] From ffee63dc57f0c99518fb2b7bb7ae0a7224aede9c Mon Sep 17 00:00:00 2001 From: null Date: Tue, 12 May 2026 17:19:34 -0500 Subject: [PATCH 3/3] feat: change camera rotation to be always active when mouse is captured --- game/scenes/Characters/location_player.gd | 18 +++++++----------- game/scenes/Interaction/RadialCommandMenu.gd | 2 ++ game/scenes/UI/start_screen.gd | 1 + game/scenes/player.gd | 18 +++++++----------- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/game/scenes/Characters/location_player.gd b/game/scenes/Characters/location_player.gd index 9948e22..9093129 100644 --- a/game/scenes/Characters/location_player.gd +++ b/game/scenes/Characters/location_player.gd @@ -19,7 +19,6 @@ const FIREBALL_SPAWN_UP_OFFSET := 1.2 var mouse_sensitivity := 0.005 var rotation_x := 0.0 var rotation_y := 0.0 -var cameraMoveMode := false var current_number_of_jumps := 0 var _pending_mouse_delta := Vector2.ZERO var _last_move_forward := Vector3(0, 0, 1) @@ -86,12 +85,13 @@ func _ready() -> void: _last_move_right = right.normalized() _vehicle_collision_layer = collision_layer _vehicle_collision_mask = collision_mask + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) func _integrate_forces(state): if _in_vehicle: linear_velocity = Vector3.ZERO return - if cameraMoveMode and _pending_mouse_delta != Vector2.ZERO: + if _pending_mouse_delta != Vector2.ZERO: rotation_x -= _pending_mouse_delta.y * mouse_sensitivity rotation_y -= _pending_mouse_delta.x * mouse_sensitivity rotation_x = clamp(rotation_x, deg_to_rad(-90), deg_to_rad(90)) @@ -156,20 +156,16 @@ func _input(event): phone_visible = !phone_visible if phone: phone.visible = phone_visible + if phone_visible: + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + else: + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) return if _in_vehicle: return - if event is InputEventMouseButton: - if event.button_index == MOUSE_BUTTON_MIDDLE: - if event.pressed: - cameraMoveMode = true - Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) - else: - cameraMoveMode = false - Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) - if event is InputEventMouseMotion and cameraMoveMode: + if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: _pending_mouse_delta += event.relative if event is InputEventMouseButton and event.pressed: diff --git a/game/scenes/Interaction/RadialCommandMenu.gd b/game/scenes/Interaction/RadialCommandMenu.gd index ef4f2e6..f11e014 100644 --- a/game/scenes/Interaction/RadialCommandMenu.gd +++ b/game/scenes/Interaction/RadialCommandMenu.gd @@ -17,8 +17,10 @@ func _toggle_menu(): # Center the menu on the mouse or screen global_position = get_viewport().get_mouse_position() _animate_menu(true) + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) else: _animate_menu(false) + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) func _arrange_buttons(): var buttons = get_children().filter(func(child): return child is Control) diff --git a/game/scenes/UI/start_screen.gd b/game/scenes/UI/start_screen.gd index 4e4c57b..2f609cf 100644 --- a/game/scenes/UI/start_screen.gd +++ b/game/scenes/UI/start_screen.gd @@ -10,6 +10,7 @@ const PLAYGROUND_SCENE := "res://scenes/Levels/level.tscn" func _ready(): _register_focus_sounds() _update_login_button() + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) func _register_focus_sounds() -> void: var button_container := $MarginContainer/CenterContainer/ContentVBox/VBoxContainer diff --git a/game/scenes/player.gd b/game/scenes/player.gd index d9dc2bb..4d8076b 100644 --- a/game/scenes/player.gd +++ b/game/scenes/player.gd @@ -19,7 +19,6 @@ const FIREBALL_SPAWN_UP_OFFSET := 1.2 var mouse_sensitivity := 0.005 var rotation_x := 0.0 var rotation_y := 0.0 -var cameraMoveMode := false var current_number_of_jumps := 0 var _pending_mouse_delta := Vector2.ZERO var _last_move_forward := Vector3(0, 0, 1) @@ -86,12 +85,13 @@ func _ready() -> void: _last_move_right = right.normalized() _vehicle_collision_layer = collision_layer _vehicle_collision_mask = collision_mask + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) func _integrate_forces(state): if _in_vehicle: linear_velocity = Vector3.ZERO return - if cameraMoveMode and _pending_mouse_delta != Vector2.ZERO: + if _pending_mouse_delta != Vector2.ZERO: rotation_x -= _pending_mouse_delta.y * mouse_sensitivity rotation_y -= _pending_mouse_delta.x * mouse_sensitivity rotation_x = clamp(rotation_x, deg_to_rad(-90), deg_to_rad(90)) # Prevent flipping @@ -164,20 +164,16 @@ func _input(event): phone_visible = !phone_visible if phone: phone.visible = phone_visible + if phone_visible: + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + else: + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) return if _in_vehicle: return - if event is InputEventMouseButton: - if event.button_index == MOUSE_BUTTON_MIDDLE: - if event.pressed: - cameraMoveMode = true - Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) - else: - cameraMoveMode = false - Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) - if event is InputEventMouseMotion and cameraMoveMode: + if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: _pending_mouse_delta += event.relative if event is InputEventMouseButton and event.pressed: