bubbles
This commit is contained in:
parent
ed87752159
commit
49b09b9bb8
9 changed files with 77 additions and 12 deletions
|
|
@ -1 +1 @@
|
|||
,rendo,kompikrendo,29.05.2026 16:54,file:///home/rendo/.config/libreoffice/4;
|
||||
,rendo,kompikrendo,28.06.2026 19:23,file:///home/rendo/.config/libreoffice/4;
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
18
scenes/bubbles.gd
Normal file
18
scenes/bubbles.gd
Normal file
|
|
@ -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)
|
||||
)
|
||||
1
scenes/bubbles.gd.uid
Normal file
1
scenes/bubbles.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://8jd32taaq5yy
|
||||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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 = []
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue