diff --git a/entities/interactables/mutation_element/mutation_element.gd b/entities/interactables/mutation_element/mutation_element.gd new file mode 100644 index 0000000..6cd0ebd --- /dev/null +++ b/entities/interactables/mutation_element/mutation_element.gd @@ -0,0 +1,28 @@ +extends Interactable3D +class_name MutationElement + +@export var mutation: PlantMutation: set = set_mutation + + +func _process(_delta: float) -> void: + if mutation: + var viewport := get_viewport() as SubViewport + var viewport_parent = viewport.get_parent() + var new_pos := global_position + var viewport_size := viewport.size + new_pos = viewport_parent.global_position + + var position_2D = get_parent().global_position + new_pos.z += position_2D.x / viewport_size.x + new_pos.y -= position_2D.y / viewport_size.y + global_position = new_pos + +func set_mutation(m: PlantMutation) -> void: + mutation = m + interactable = false + inspectable = true + +func card_info() -> CardInfo: + if mutation: + return mutation.card_info() + return null diff --git a/entities/interactables/mutation_element/mutation_element.gd.uid b/entities/interactables/mutation_element/mutation_element.gd.uid new file mode 100644 index 0000000..6f5fd17 --- /dev/null +++ b/entities/interactables/mutation_element/mutation_element.gd.uid @@ -0,0 +1 @@ +uid://cf0b6gm06fvy1 diff --git a/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/mutation_discovery_element.tscn b/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/mutation_discovery_element.tscn index 5429a42..7a74932 100644 --- a/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/mutation_discovery_element.tscn +++ b/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/mutation_discovery_element.tscn @@ -5,6 +5,11 @@ [ext_resource type="Texture2D" uid="uid://cgt4n1xwn4dc2" path="res://common/icons/hexagon.svg" id="1_wfsg0"] [ext_resource type="Texture2D" uid="uid://cul11ab04vf8i" path="res://common/icons/hexagon-lock.svg" id="3_udmux"] [ext_resource type="Texture2D" uid="uid://cwewx7cdy085h" path="res://common/icons/help-hexagon.svg" id="4_0ou8m"] +[ext_resource type="Script" uid="uid://cf0b6gm06fvy1" path="res://entities/interactables/mutation_element/mutation_element.gd" id="6_0ou8m"] +[ext_resource type="PackedScene" uid="uid://i28ngc4hgq85" path="res://stages/3d_scenes/cockpit_scene/assets/3d/furnitures/screen.blend" id="7_fw2k7"] + +[sub_resource type="SphereShape3D" id="SphereShape3D_g4v7s"] +radius = 0.037951604 [node name="MutationDiscoveryElement" type="Control" unique_id=701137276] custom_minimum_size = Vector2(80, 80) @@ -93,3 +98,16 @@ grow_vertical = 2 texture = ExtResource("1_d34h0") expand_mode = 1 stretch_mode = 5 + +[node name="MutationElement" type="Area3D" parent="." unique_id=1075272683] +unique_name_in_owner = true +script = ExtResource("6_0ou8m") +interactable = false +inspectable = true +metadata/_custom_type_script = "uid://cf0b6gm06fvy1" + +[node name="CollisionShape3D" type="CollisionShape3D" parent="MutationElement" unique_id=1480063396] +shape = SubResource("SphereShape3D_g4v7s") + +[node name="ScreenModel" parent="MutationElement" unique_id=1206832173 instance=ExtResource("7_fw2k7")] +transform = Transform3D(0.075, 0, 0, 0, 0.075, 0, 0, 0, 0.075, 0, 0, 0) diff --git a/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/mutation_discovery_screen.tscn b/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/mutation_discovery_screen.tscn index 5f2123f..78a25e0 100644 --- a/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/mutation_discovery_screen.tscn +++ b/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/mutation_discovery_screen.tscn @@ -21,7 +21,7 @@ script = ExtResource("5_74fqo") metadata/_custom_type_script = "uid://7bfgsrkp6gaq" [sub_resource type="ViewportTexture" id="ViewportTexture_c5x8t"] -viewport_path = NodePath("Sprite3D/SubViewport") +viewport_path = NodePath("Title/SubViewport") [sub_resource type="LabelSettings" id="LabelSettings_5jpjd"] font = ExtResource("2_kjjrb") @@ -35,17 +35,19 @@ font_size = 20 script = ExtResource("1_cfhhl") all_mutations = Array[ExtResource("2_dv1aj")]([SubResource("Resource_dv1aj"), SubResource("Resource_3q2hk"), SubResource("Resource_psve5"), null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]) -[node name="Sprite3D" type="Sprite3D" parent="." unique_id=1624784968] -transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -0.011004657, 0, 0) +[node name="Title" type="Sprite3D" parent="." unique_id=1624784968] +transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -0.011004657, 0.18445392, 0) pixel_size = 0.001 texture = SubResource("ViewportTexture_c5x8t") -[node name="SubViewport" type="SubViewport" parent="Sprite3D" unique_id=1689184715] +[node name="SubViewport" type="SubViewport" parent="Title" unique_id=1689184715] disable_3d = true transparent_bg = true -size = Vector2i(813, 592) +handle_input_locally = false +size = Vector2i(813, 187) +render_target_update_mode = 4 -[node name="VBoxContainer" type="VBoxContainer" parent="Sprite3D/SubViewport" unique_id=1462242714] +[node name="VBoxContainer" type="VBoxContainer" parent="Title/SubViewport" unique_id=1462242714] anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -54,7 +56,8 @@ grow_vertical = 2 theme_override_constants/separation = 16 alignment = 1 -[node name="Label" type="Label" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=1148366912] +[node name="Label" type="Label" parent="Title/SubViewport/VBoxContainer" unique_id=208658567] +custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_vertical = 1 text = "DISCOVERED_MUTATIONS" @@ -62,7 +65,8 @@ label_settings = SubResource("LabelSettings_5jpjd") horizontal_alignment = 1 autowrap_mode = 3 -[node name="Label2" type="Label" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=1245847739] +[node name="Label2" type="Label" parent="Title/SubViewport/VBoxContainer" unique_id=1203019659] +custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_vertical = 1 text = "PLANT_SEEDS_TO_DISCOVER_MUTATIONS" @@ -70,8 +74,28 @@ label_settings = SubResource("LabelSettings_dv1aj") horizontal_alignment = 1 autowrap_mode = 3 -[node name="MutationContainer" type="HFlowContainer" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=1585516203] -unique_name_in_owner = true +[node name="Sprite3D" type="Sprite3D" parent="." unique_id=1919294387] +transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -0.011004656, -0.022848502, 0.011004657) +pixel_size = 0.001 +texture = SubResource("ViewportTexture_c5x8t") + +[node name="SubViewport" type="SubViewport" parent="Sprite3D" unique_id=1983077856] +disable_3d = true +transparent_bg = true +handle_input_locally = false +size = Vector2i(813, 592) +render_target_update_mode = 4 + +[node name="VBoxContainer" type="VBoxContainer" parent="Sprite3D/SubViewport" unique_id=28002807] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/separation = 16 +alignment = 1 + +[node name="MutationContainer" type="HFlowContainer" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=1675692211] layout_mode = 2 alignment = 1 last_wrap_alignment = 2 diff --git a/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/scripts/mutation_discovery_element.gd b/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/scripts/mutation_discovery_element.gd index 8268cd9..7d4e816 100644 --- a/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/scripts/mutation_discovery_element.gd +++ b/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/scripts/mutation_discovery_element.gd @@ -2,15 +2,16 @@ extends Control class_name MutationDiscoveryElement -enum State {DISCOVERED,UNDISCOVERED,LOCKED} +enum State {DISCOVERED, UNDISCOVERED, LOCKED} -@export var state : State = State.UNDISCOVERED : +@export var state: State = State.UNDISCOVERED: set(v): state = v update() -@export var mutation : PlantMutation : +@export var mutation: PlantMutation: set(v): mutation = v + %MutationElement.mutation = mutation update() func _ready(): diff --git a/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/scripts/mutation_discovery_screen.gd b/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/scripts/mutation_discovery_screen.gd index d698cbe..dfdf7c2 100644 --- a/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/scripts/mutation_discovery_screen.gd +++ b/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/scripts/mutation_discovery_screen.gd @@ -22,7 +22,7 @@ func update(): for c in %MutationContainer.get_children(): c.queue_free() for i in range(len(all_mutations)): - var el : MutationDiscoveryElement = MUTATION_DISCOVERY_ELEMENT_SCENE.instantiate() as MutationDiscoveryElement + var el := MUTATION_DISCOVERY_ELEMENT_SCENE.instantiate() as MutationDiscoveryElement if i < mutations_unlocked: el.mutation = all_mutations[i] if el.mutation.get_mutation_id() in planted_mutation_ids: