diff --git a/.~lock.Работы по химии TODO.docx# b/.~lock.Работы по химии TODO.docx# index 083cc6b..26b004b 100644 --- a/.~lock.Работы по химии TODO.docx# +++ b/.~lock.Работы по химии TODO.docx# @@ -1 +1 @@ -,rendo,kompikrendo,29.05.2026 16:54,file:///home/rendo/.config/libreoffice/4; \ No newline at end of file +,rendo,kompikrendo,28.06.2026 19:23,file:///home/rendo/.config/libreoffice/4; \ No newline at end of file diff --git a/assets/textures/bubble.png.import b/assets/textures/bubble.png.import index 07769dc..46d3ca3 100644 --- a/assets/textures/bubble.png.import +++ b/assets/textures/bubble.png.import @@ -3,19 +3,20 @@ importer="texture" type="CompressedTexture2D" uid="uid://bkuxwtxum1r4x" -path="res://.godot/imported/bubble.png-a4e9df5e78917cd4475ee7b84b1534f0.ctex" +path.s3tc="res://.godot/imported/bubble.png-a4e9df5e78917cd4475ee7b84b1534f0.s3tc.ctex" metadata={ -"vram_texture": false +"imported_formats": ["s3tc_bptc"], +"vram_texture": true } [deps] source_file="res://assets/textures/bubble.png" -dest_files=["res://.godot/imported/bubble.png-a4e9df5e78917cd4475ee7b84b1534f0.ctex"] +dest_files=["res://.godot/imported/bubble.png-a4e9df5e78917cd4475ee7b84b1534f0.s3tc.ctex"] [params] -compress/mode=0 +compress/mode=2 compress/high_quality=false compress/lossy_quality=0.7 compress/uastc_level=0 @@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 -mipmaps/generate=false +mipmaps/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" @@ -37,4 +38,4 @@ process/normal_map_invert_y=false process/hdr_as_srgb=false process/hdr_clamp_exposure=false process/size_limit=0 -detect_3d/compress_to=1 +detect_3d/compress_to=0 diff --git a/project.godot b/project.godot index 78618d2..fcca46e 100644 --- a/project.godot +++ b/project.godot @@ -16,7 +16,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true config/name="lab-electrolyte" run/main_scene="uid://c2ciwyjf7au6l" -config/features=PackedStringArray("4.6", "Mobile") +config/features=PackedStringArray("4.7", "Mobile") config/icon="res://icon.svg" [autoload] diff --git a/scenes/bubbles.gd b/scenes/bubbles.gd new file mode 100644 index 0000000..227b91f --- /dev/null +++ b/scenes/bubbles.gd @@ -0,0 +1,18 @@ +extends GPUParticles3D + + +@export var inventory: Inventory +@export var particles: GPUParticles3D +var tween: Tween + +func _on_inventory_reacted_with_gasses(gasses: Array[RuntimeSubstanceData]) -> void: + if tween: + tween.kill() + tween = create_tween() + particles.emitting = true + tween.tween_interval(2.) + tween.tween_callback(func(): + particles.emitting = false + for gas in gasses: + inventory.extract_substance(gas.substance.get_formula(),gas.amount) + ) diff --git a/scenes/bubbles.gd.uid b/scenes/bubbles.gd.uid new file mode 100644 index 0000000..1e475bc --- /dev/null +++ b/scenes/bubbles.gd.uid @@ -0,0 +1 @@ +uid://8jd32taaq5yy diff --git a/scenes/flask.tscn b/scenes/flask.tscn index 19c3a85..d04cc86 100644 --- a/scenes/flask.tscn +++ b/scenes/flask.tscn @@ -7,7 +7,9 @@ [ext_resource type="Script" uid="uid://bl0ojhc0thk1p" path="res://src/interactible/interactible.gd" id="4_dbm1u"] [ext_resource type="Texture2D" uid="uid://cw3jw8qbvj3fv" path="res://assets/textures/solid.png" id="4_h7awq"] [ext_resource type="Script" uid="uid://duirfi4j26g2i" path="res://src/interactible/flask_interaction.gd" id="5_pmegg"] +[ext_resource type="Texture2D" uid="uid://bkuxwtxum1r4x" path="res://assets/textures/bubble.png" id="6_rqua0"] [ext_resource type="Script" uid="uid://82ettbegollp" path="res://src/inventory.gd" id="7_h7awq"] +[ext_resource type="Script" uid="uid://8jd32taaq5yy" path="res://scenes/bubbles.gd" id="7_wadb5"] [ext_resource type="Script" uid="uid://mqch4ruivbg8" path="res://src/position_resetter.gd" id="9_kkw7a"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_vcwhe"] @@ -74,6 +76,24 @@ bottom_radius = 0.772 radial_segments = 16 rings = 0 +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_u7u8q"] +emission_shape_scale = Vector3(0.755, 0.93, 0.755) +emission_shape = 1 +emission_sphere_radius = 1.0 +gravity = Vector3(0, 1, 0) +collision_mode = 1 +collision_friction = 0.0 +collision_bounce = 0.0 + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_t5c10"] +transparency = 1 +albedo_texture = ExtResource("6_rqua0") +billboard_mode = 1 + +[sub_resource type="QuadMesh" id="QuadMesh_iuc1c"] +material = SubResource("StandardMaterial3D_t5c10") +size = Vector2(0.05, 0.05) + [node name="Flask" type="Area3D" unique_id=516093165 node_paths=PackedStringArray("interactible") groups=["flask"]] collision_layer = 5 script = ExtResource("1_0xufn") @@ -89,12 +109,13 @@ transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0.1, 0) mesh = SubResource("ArrayMesh_nvewc") skeleton = NodePath("") -[node name="FillLiquid" type="MeshInstance3D" parent="Flash" unique_id=439339804] +[node name="FillLiquid" type="MeshInstance3D" parent="Flash" unique_id=439339804 node_paths=PackedStringArray("particle_collision")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.8061247, 0) material_override = SubResource("ShaderMaterial_ailwx") mesh = SubResource("CylinderMesh_h7awq") skeleton = NodePath("") script = ExtResource("3_0xufn") +particle_collision = NodePath("../GPUParticlesCollisionBox3D") [node name="FillSolid" type="MeshInstance3D" parent="Flash" unique_id=390551675] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8061155, 0) @@ -105,6 +126,18 @@ skeleton = NodePath("") script = ExtResource("3_0xufn") display_type = 1 +[node name="GPUParticlesCollisionBox3D" type="GPUParticlesCollisionBox3D" parent="Flash" unique_id=330053589] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5932534, 0) +size = Vector3(2.7734375, 1.1738281, 3.2333984) + +[node name="GPUParticles3D" type="GPUParticles3D" parent="Flash" unique_id=2054685714] +emitting = false +lifetime = 3.0 +local_coords = true +process_material = SubResource("ParticleProcessMaterial_u7u8q") +draw_pass_1 = SubResource("QuadMesh_iuc1c") +script = ExtResource("7_wadb5") + [node name="Inventory" type="Node" parent="." unique_id=1748297338] unique_name_in_owner = true script = ExtResource("7_h7awq") @@ -147,5 +180,6 @@ script = ExtResource("9_kkw7a") [connection signal="drag_started" from="." to="PositionResetter" method="_on_flask_drag_started"] [connection signal="inventory_changed" from="Inventory" to="Flash/FillLiquid" method="update_material_unfiltered"] [connection signal="inventory_changed" from="Inventory" to="Flash/FillSolid" method="update_material_unfiltered"] +[connection signal="reacted_with_gasses" from="Inventory" to="Flash/GPUParticles3D" method="_on_inventory_reacted_with_gasses"] [connection signal="interacted" from="Interactible" to="Interactible/Interaction" method="_on_interactible_interacted"] [connection signal="value_changed" from="Interactible/HBoxContainer/HSlider" to="Interactible/Interaction" method="_on_h_slider_value_changed"] diff --git a/src/inventory.gd b/src/inventory.gd index 897c283..5a95666 100644 --- a/src/inventory.gd +++ b/src/inventory.gd @@ -23,6 +23,7 @@ var total_amount: float: return result signal inventory_changed(substances: Array[RuntimeSubstanceData], capacity: float) +signal reacted_with_gasses(gasses: Array[RuntimeSubstanceData]) signal temperature_changed(to: float) func _ready() -> void: @@ -179,15 +180,23 @@ func check_for_reactions() -> void: add_substance_no_callback(data) check_for_reactions() recalculate_temperature() + + var gasses = find_gases() + if gasses != []: + reacted_with_gasses.emit(gasses) + update_solutions() inventory_changed.emit(inventory.values(),capacity) GuiSignalBus.push("Произошла реакция") if len(find_odor()) > 0: GuiSignalBus.push("Появился запах") -#func find_gases() -> Array[RuntimeSubstanceData]: -# for key in inventory: -# if inventory[key].substance in [preload("H")] +func find_gases() -> Array[RuntimeSubstanceData]: + var gasses: Array[RuntimeSubstanceData] = [] + for key in inventory: + if inventory[key].substance.boiling_point < mean_temperature: + gasses.append(inventory[key]) + return gasses func find_odor() -> Array[RuntimeSubstanceData]: var result = [] diff --git a/src/substance_display.gd b/src/substance_display.gd index 51805bc..a9f3b60 100644 --- a/src/substance_display.gd +++ b/src/substance_display.gd @@ -11,6 +11,7 @@ enum DisplayType{ var tween = create_tween() material_override.set_shader_parameter("wave_intensity",1.) tween.tween_property(material_override,"shader_parameter/wave_intensity",0.0,2.0) +@export var particle_collision: GPUParticlesCollisionBox3D func update_fluid_material(substances: Array[RuntimeSubstanceData],capacity: float) -> void: var mat: ShaderMaterial = material_override @@ -53,6 +54,7 @@ func update_fluid_material(substances: Array[RuntimeSubstanceData],capacity: flo mat.set_shader_parameter("albedo_color", color / total_color) mat.set_shader_parameter("fill",total_weight/capacity) + particle_collision.position.y = + particle_collision.size.y/2 + position.y - 4 + 8 * total_weight/capacity func update_solid_material(substances: Array[RuntimeSubstanceData]) -> void: var mat: StandardMaterial3D = material_override diff --git a/Работы по химии TODO.docx b/Работы по химии TODO.docx index d22917c..4f3ad2f 100644 Binary files a/Работы по химии TODO.docx and b/Работы по химии TODO.docx differ