From 8966aa041578571c286b6c0dbb4adeada74ab44c Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 25 Mar 2026 10:42:55 +0000 Subject: [PATCH] Player: Don't emit dust particles initially Since commit 63fdec1608180cb84a3b8e09892f908cc379b1cb ("Player: Use InputWalkBehavior"), PlayerDustParticles.emitting is not updated every frame; it is only updated when the InputWalkBehavior emits running_changed. It is not explicitly initialised when the scene is loaded. In player.tcsn, PlayerDustParticles.emitting was set to its default value, `true`. As a result, particles are emitted until the player first starts then stops running. Set PlayerDustParticles.emitting to false by default. The InputWalkBehavior change also meant that the particles' direction is no longer updated as the player changes direction while running. Rather than reimplementing this: change the initial particle velocity to 0, and remove the code to update the direction. Having done that, we can actually remove the entire player_dust_particles script, and connect InputWalkBehavior.running_changed to GPUParticles2D.set_emitting directly. --- .../player/components/player_dust_particles.gd | 11 ----------- .../player/components/player_dust_particles.gd.uid | 1 - scenes/game_elements/characters/player/player.tscn | 13 +++---------- 3 files changed, 3 insertions(+), 22 deletions(-) delete mode 100644 scenes/game_elements/characters/player/components/player_dust_particles.gd delete mode 100644 scenes/game_elements/characters/player/components/player_dust_particles.gd.uid diff --git a/scenes/game_elements/characters/player/components/player_dust_particles.gd b/scenes/game_elements/characters/player/components/player_dust_particles.gd deleted file mode 100644 index 71e8e5b6a1..0000000000 --- a/scenes/game_elements/characters/player/components/player_dust_particles.gd +++ /dev/null @@ -1,11 +0,0 @@ -# SPDX-FileCopyrightText: The Threadbare Authors -# SPDX-License-Identifier: MPL-2.0 -extends GPUParticles2D - -@onready var player: Player = owner - - -func _on_input_walk_behavior_running_changed(is_running: bool) -> void: - emitting = is_running - if emitting: - process_material.direction = Vector3(player.velocity.x, player.velocity.y, 0.0) diff --git a/scenes/game_elements/characters/player/components/player_dust_particles.gd.uid b/scenes/game_elements/characters/player/components/player_dust_particles.gd.uid deleted file mode 100644 index 7e16784628..0000000000 --- a/scenes/game_elements/characters/player/components/player_dust_particles.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://ciw2w16c38ewq diff --git a/scenes/game_elements/characters/player/player.tscn b/scenes/game_elements/characters/player/player.tscn index dd9ae46b46..1d3dc69211 100644 --- a/scenes/game_elements/characters/player/player.tscn +++ b/scenes/game_elements/characters/player/player.tscn @@ -6,7 +6,6 @@ [ext_resource type="SpriteFrames" uid="uid://vwf8e1v8brdp" path="res://scenes/quests/template_quests/NO_EDIT/NO_EDIT_player_components/NO_EDIT_player.tres" id="2_blfj0"] [ext_resource type="Script" uid="uid://csev4hv57utxv" path="res://scenes/game_logic/walk_behaviors/character_speeds.gd" id="3_cvb4d"] [ext_resource type="Script" uid="uid://bpu6jo4kvehlg" path="res://scenes/game_elements/characters/player/components/player_interaction.gd" id="3_dqkch"] -[ext_resource type="Script" uid="uid://ciw2w16c38ewq" path="res://scenes/game_elements/characters/player/components/player_dust_particles.gd" id="3_j0tly"] [ext_resource type="Script" uid="uid://qro4uo83ba8f" path="res://scenes/game_elements/characters/player/components/player_sprite.gd" id="3_qlg0r"] [ext_resource type="Script" uid="uid://necvar42rnih" path="res://scenes/game_elements/props/character_sight/character_sight.gd" id="6_3in67"] [ext_resource type="PackedScene" uid="uid://yfpfno276rol" path="res://scenes/game_elements/props/fixed_size_label/fixed_size_label.tscn" id="6_h17s1"] @@ -25,10 +24,6 @@ script = ExtResource("3_cvb4d") metadata/_custom_type_script = "uid://csev4hv57utxv" -[sub_resource type="Resource" id="Resource_ubfef"] -script = ExtResource("3_cvb4d") -metadata/_custom_type_script = "uid://csev4hv57utxv" - [sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_j0tly"] blend_mode = 1 particles_animation = true @@ -65,8 +60,6 @@ particle_flag_disable_z = true emission_shape = 1 emission_sphere_radius = 25.0 spread = 0.0 -initial_velocity_min = -40.0 -initial_velocity_max = -10.0 directional_velocity_min = 1.0 directional_velocity_max = 1.0 directional_velocity_curve = SubResource("CurveXYZTexture_3in67") @@ -536,7 +529,7 @@ speeds = SubResource("Resource_cvb4d") [node name="InputWalkBehavior" type="Node2D" parent="." unique_id=1817340985 node_paths=PackedStringArray("character")] unique_name_in_owner = true script = ExtResource("2_5lbww") -speeds = SubResource("Resource_ubfef") +speeds = SubResource("Resource_cvb4d") character = NodePath("..") metadata/_custom_type_script = "uid://c8xbryhknipab" @@ -545,13 +538,13 @@ unique_name_in_owner = true modulate = Color(1, 1, 1, 0.498039) material = SubResource("CanvasItemMaterial_j0tly") position = Vector2(0, -6) +emitting = false amount = 6 texture = ExtResource("12_3in67") lifetime = 0.5 randomness = 0.6 fixed_fps = 10 process_material = SubResource("ParticleProcessMaterial_nrnyj") -script = ExtResource("3_j0tly") [node name="PlayerSprite" type="AnimatedSprite2D" parent="." unique_id=1785485617] unique_name_in_owner = true @@ -676,7 +669,7 @@ unique_name_in_owner = true root_node = NodePath("../../PlayerRepel") libraries/ = SubResource("AnimationLibrary_1n58k") -[connection signal="running_changed" from="InputWalkBehavior" to="PlayerDustParticles" method="_on_input_walk_behavior_running_changed"] +[connection signal="running_changed" from="InputWalkBehavior" to="PlayerDustParticles" method="set_emitting"] [connection signal="running_changed" from="InputWalkBehavior" to="AnimationPlayer" method="_on_input_walk_behavior_running_changed"] [connection signal="body_entered" from="PlayerRepel/AirStream" to="PlayerRepel" method="_on_air_stream_body_entered"] [connection signal="aiming_changed" from="PlayerHook" to="." method="_on_player_hook_aiming_changed"]