From c56f654751fcf3ff8c80e57ff3bcae8eb9ac43c6 Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Wed, 17 Sep 2025 17:58:28 +0200 Subject: [PATCH] Set up second garden with beetroot, built transition from yard and back --- prefabs/farm/plants/base_plant.tscn | 4 +- scenes/Babushka_scene_farm_outside_2d.tscn | 55 ++-- scenes/Babushka_scene_outside_beets.tscn | 273 +++++++----------- .../CSharp/Common/Farming/PlantBehaviour2D.cs | 35 ++- 4 files changed, 155 insertions(+), 212 deletions(-) diff --git a/prefabs/farm/plants/base_plant.tscn b/prefabs/farm/plants/base_plant.tscn index ec854c3..7fc7174 100644 --- a/prefabs/farm/plants/base_plant.tscn +++ b/prefabs/farm/plants/base_plant.tscn @@ -12,9 +12,9 @@ [sub_resource type="ShaderMaterial" id="ShaderMaterial_u4cty"] shader = ExtResource("3_7hdur") -shader_parameter/speed = 3.0 +shader_parameter/speed = 2.0 shader_parameter/minStrength = 0.05 -shader_parameter/maxStrength = 0.36 +shader_parameter/maxStrength = 0.206 shader_parameter/strengthScale = 100.0 shader_parameter/interval = 3.5 shader_parameter/detail = 1.0 diff --git a/scenes/Babushka_scene_farm_outside_2d.tscn b/scenes/Babushka_scene_farm_outside_2d.tscn index 381bb0d..1ece207 100644 --- a/scenes/Babushka_scene_farm_outside_2d.tscn +++ b/scenes/Babushka_scene_farm_outside_2d.tscn @@ -217,25 +217,25 @@ size = Vector2(5782, 1176) resource_local_to_scene = true size = Vector2(7150, 1192) -[sub_resource type="ShaderMaterial" id="ShaderMaterial_uxa2m"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_lwk6t"] shader = ExtResource("13_7p0hq") shader_parameter/hue_shift = 0.0 -shader_parameter/saturation_mult = 0.753 +shader_parameter/saturation_mult = 0.871 shader_parameter/value_mult = 1.0 shader_parameter/brightness_add = 0.0 shader_parameter/contrast_mult = 1.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_lwk6t"] +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ycj14"] +size = Vector2(707.116, 604.111) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_uxa2m"] shader = ExtResource("13_7p0hq") shader_parameter/hue_shift = 0.0 -shader_parameter/saturation_mult = 0.871 +shader_parameter/saturation_mult = 0.753 shader_parameter/value_mult = 1.0 shader_parameter/brightness_add = 0.0 shader_parameter/contrast_mult = 1.0 -[sub_resource type="RectangleShape2D" id="RectangleShape2D_ycj14"] -size = Vector2(707.116, 604.111) - [sub_resource type="AudioStreamPlaylist" id="AudioStreamPlaylist_ceriq"] loop = false stream_count = 1 @@ -271,7 +271,7 @@ metadata/_custom_type_script = "uid://be54lnb6gg81f" [node name="BabushkaSceneFarmOutside2d" type="Node2D"] script = ExtResource("34_e5b7x") -_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_indoor_common_room.tscn") +_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_indoor_common_room.tscn", "res://scenes/Babushka_scene_outside_beets.tscn") [node name="Camera2D" type="Camera2D" parent="." node_paths=PackedStringArray("_followNode")] position = Vector2(3180, 1961) @@ -1105,6 +1105,7 @@ shape = SubResource("CircleShape2D_tm0yg") scale = Vector2(1, 1) [node name="SeedPickup2" parent="YSorted" instance=ExtResource("25_hukxv")] +visible = false position = Vector2(10892, 2469) _finiteSupply = 3 @@ -1139,7 +1140,7 @@ position = Vector2(-252.56, 231.32) polygon = PackedVector2Array(247.227, 43.5123, 44.7822, 43.5123, -87.2178, 45.123, -104.329, -55.2797, -154.107, -73.5347, -160.107, -380.38, -175.44, -400.783, -63.44, -512.461, 97.8934, -541.991, 261.671, -599.172, 374.782, -526.421, 502.338, -526.421, 637.893, -396.488, 598.56, -360.783, 596.338, -58.2327, 528.782, -58.2327, 501.449, 45.9283) [node name="EnterHouseInteraction" parent="YSorted/Farm visuals/Static" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("27_klb81")] -position = Vector2(5839, 2349) +position = Vector2(5834, 2354) scale = Vector2(2.425, 2.425) _spriteToOutline = NodePath("DoorSprite") _id = 0 @@ -2115,21 +2116,6 @@ shape = SubResource("RectangleShape2D_p6n74") [node name="Blocker" type="Node2D" parent="YSorted"] -[node name="Fence Door" type="Sprite2D" parent="YSorted/Blocker"] -material = SubResource("ShaderMaterial_uxa2m") -position = Vector2(11205, 1560) -rotation = 0.00432089 -scale = Vector2(-0.905, 0.925) -texture = ExtResource("49_i36hd") - -[node name="StaticBody2D" type="StaticBody2D" parent="YSorted/Blocker/Fence Door"] -collision_layer = 2 -collision_mask = 4 - -[node name="CollisionShape2D" type="CollisionShape2D" parent="YSorted/Blocker/Fence Door/StaticBody2D"] -position = Vector2(-113.561, 193.035) -shape = SubResource("RectangleShape2D_2vojv") - [node name="Fence Door2" type="Sprite2D" parent="YSorted/Blocker"] material = SubResource("ShaderMaterial_lwk6t") position = Vector2(3788, 1563) @@ -2145,6 +2131,26 @@ collision_mask = 4 position = Vector2(-106.663, 182.891) shape = SubResource("RectangleShape2D_ycj14") +[node name="InteractionArea" parent="YSorted/Blocker" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("27_klb81")] +position = Vector2(11234, 1850) +_spriteToOutline = NodePath("Fence Door") +_id = 1 + +[node name="Fence Door" type="Sprite2D" parent="YSorted/Blocker/InteractionArea"] +material = SubResource("ShaderMaterial_uxa2m") +position = Vector2(1, -271) +rotation = -3.13727 +scale = Vector2(0.905, -0.925) +texture = ExtResource("49_i36hd") + +[node name="StaticBody2D" type="StaticBody2D" parent="YSorted/Blocker/InteractionArea/Fence Door"] +collision_layer = 2 +collision_mask = 4 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="YSorted/Blocker/InteractionArea/Fence Door/StaticBody2D"] +position = Vector2(-113.561, 193.035) +shape = SubResource("RectangleShape2D_2vojv") + [node name="ducks" type="Node2D" parent="YSorted"] z_index = 1 y_sort_enabled = true @@ -2389,6 +2395,7 @@ timeline = "quest2_tomatoes_end" [connection signal="InteractedTool" from="YSorted/Farm visuals/Static/EnterHouseInteraction" to="." method="LoadSceneAtIndex"] [connection signal="FieldCreated" from="YSorted/Farm visuals/FieldParent" to="Audio/SFX/Farming SFX" method="PlayOneShot"] [connection signal="input_event" from="YSorted/Farm visuals/FieldParent/Area2D" to="YSorted/Vesna/FarmingControls" method="InputEventPressedOn"] +[connection signal="InteractedTool" from="YSorted/Blocker/InteractionArea" to="." method="LoadSceneAtIndex"] [connection signal="GoalReached" from="YSorted/ducks" to="YSorted/ducks/DialogicToggle" method="ToggleDialogue"] [connection signal="DuckCollected" from="YSorted/ducks/Duck2" to="YSorted/ducks" method="Increment"] [connection signal="DuckCollected" from="YSorted/ducks/Duck3" to="YSorted/ducks" method="Increment"] diff --git a/scenes/Babushka_scene_outside_beets.tscn b/scenes/Babushka_scene_outside_beets.tscn index cea1adf..dc2747c 100644 --- a/scenes/Babushka_scene_outside_beets.tscn +++ b/scenes/Babushka_scene_outside_beets.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=92 format=3 uid="uid://b3ibx4resa1f3"] +[gd_scene load_steps=81 format=3 uid="uid://b3ibx4resa1f3"] [ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_6krrk"] [ext_resource type="Script" uid="uid://bqomwxclsbhd3" path="res://scripts/CSharp/Common/Camera/CameraController.cs" id="2_4ktoi"] @@ -28,18 +28,16 @@ [ext_resource type="Texture2D" uid="uid://3ed3dgq3irn2" path="res://art/farm/farming/farmobjekte/zaun/tilable fence end part2.png" id="26_bwvai"] [ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Player2D.tscn" id="27_qtaxr"] [ext_resource type="Resource" uid="uid://dlcmqfjvgphqu" path="res://resources/items/rake.tres" id="28_le48k"] -[ext_resource type="Resource" uid="uid://cndd64batns31" path="res://resources/items/wateringcan.tres" id="29_6laxt"] [ext_resource type="Texture2D" uid="uid://dg7rlugnq0t45" path="res://art/farm/farming/farmobjekte/brünnen.png" id="30_lgb3w"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="31_xcb8u"] -[ext_resource type="PackedScene" uid="uid://dpbbroif2tnil" path="res://prefabs/interactions/generic_item_on_ground_2d.tscn" id="32_752hh"] -[ext_resource type="Resource" uid="uid://c5yg3lx756v4v" path="res://resources/items/hoe.tres" id="33_v0fwx"] [ext_resource type="Shader" uid="uid://braevmqauoek7" path="res://shader/swaying_plant.gdshader" id="37_7c2wq"] [ext_resource type="Texture2D" uid="uid://bq2wojyy4ptva" path="res://art/nature/baum märz 2025/sonnenblume7.png" id="38_0bsmo"] [ext_resource type="Texture2D" uid="uid://dgavbfci8x178" path="res://art/nature/grass/grass-1.png" id="39_8mefg"] [ext_resource type="Texture2D" uid="uid://h2b5aufaaw7w" path="res://art/nature/grass/grass-2.png" id="40_67iq1"] +[ext_resource type="PackedScene" uid="uid://b1d2e7ely6hyw" path="res://prefabs/farm/base_field.tscn" id="40_efblm"] [ext_resource type="Texture2D" uid="uid://b644ofy7fml5w" path="res://art/nature/grass/grass-5.png" id="41_0irm8"] +[ext_resource type="PackedScene" uid="uid://dp8ielst8et4c" path="res://prefabs/farm/plants/beet_plant.tscn" id="41_3kije"] [ext_resource type="Texture2D" uid="uid://badnnid7dgnpk" path="res://art/nature/grass/grass-4.png" id="42_7jeth"] -[ext_resource type="PackedScene" uid="uid://d4m5iy5mwqpq3" path="res://prefabs/farm/beet_field.tscn" id="43_dr6bm"] [ext_resource type="Texture2D" uid="uid://ct7ea8ikor5rf" path="res://art/nature/grass/grass-3.png" id="43_g8k4k"] [ext_resource type="Texture2D" uid="uid://d3dwl6ph0pu1d" path="res://art/nature/grass/grass-6.png" id="44_jgrpl"] [ext_resource type="Script" uid="uid://dhxtdhfqx3bte" path="res://scripts/CSharp/Common/Farming/FieldService2D.cs" id="46_xkmgh"] @@ -137,18 +135,6 @@ size = Vector2(1041, 368) resource_local_to_scene = true radius = 371.058 -[sub_resource type="CircleShape2D" id="CircleShape2D_dr6bm"] -resource_local_to_scene = true -radius = 300.0 - -[sub_resource type="CircleShape2D" id="CircleShape2D_34r5t"] -resource_local_to_scene = true -radius = 300.0 - -[sub_resource type="CircleShape2D" id="CircleShape2D_hpgl7"] -resource_local_to_scene = true -radius = 300.0 - [sub_resource type="ShaderMaterial" id="ShaderMaterial_bcdgk"] shader = ExtResource("37_7c2wq") shader_parameter/speed = 1.0 @@ -177,30 +163,6 @@ shader_parameter/offset = 0.0 shader = ExtResource("24_anpd4") shader_parameter/tiling_scale = Vector2(1, 20) -[sub_resource type="CircleShape2D" id="CircleShape2D_qavgq"] -resource_local_to_scene = true -radius = 300.0 - -[sub_resource type="CircleShape2D" id="CircleShape2D_njxly"] -resource_local_to_scene = true -radius = 300.0 - -[sub_resource type="CircleShape2D" id="CircleShape2D_54ty3"] -resource_local_to_scene = true -radius = 300.0 - -[sub_resource type="CircleShape2D" id="CircleShape2D_gbxtf"] -resource_local_to_scene = true -radius = 300.0 - -[sub_resource type="CircleShape2D" id="CircleShape2D_6krrk"] -resource_local_to_scene = true -radius = 300.0 - -[sub_resource type="CircleShape2D" id="CircleShape2D_4ktoi"] -resource_local_to_scene = true -radius = 300.0 - [sub_resource type="ShaderMaterial" id="ShaderMaterial_lwk6t"] shader = ExtResource("17_lwdq7") shader_parameter/hue_shift = 0.0 @@ -235,7 +197,7 @@ stream_2/stream = ExtResource("63_td2xu") [node name="BabushkaSceneFarmOutside2d" type="Node2D"] script = ExtResource("1_6krrk") -_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_indoor_common_room.tscn") +_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn") [node name="Camera2D" type="Camera2D" parent="." node_paths=PackedStringArray("_followNode")] position = Vector2(3180, 1961) @@ -959,7 +921,6 @@ position = Vector2(-33, 554) _camera = NodePath("../../../Camera2D") [node name="Brünnen" type="Sprite2D" parent="YSorted"] -visible = false z_index = 1 y_sort_enabled = true material = SubResource("ShaderMaterial_2vojv") @@ -976,43 +937,14 @@ collision_mask = 4 position = Vector2(145.5, -224) shape = SubResource("RectangleShape2D_0sfl7") -[node name="InteractionArea" parent="YSorted/Brünnen" instance=ExtResource("31_xcb8u")] +[node name="InteractionArea" parent="YSorted/Brünnen" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("31_xcb8u")] +_spriteToOutline = NodePath("..") _id = 1 [node name="CollisionShape3D" parent="YSorted/Brünnen/InteractionArea/Area2D" index="0"] position = Vector2(146, -130) shape = SubResource("CircleShape2D_p6n74") -[node name="HoeGenericPickup" parent="YSorted" instance=ExtResource("32_752hh")] -visible = false -position = Vector2(6095, 2087) - -[node name="SpawnWithItem" parent="YSorted/HoeGenericPickup" index="0"] -_blueprint = ExtResource("33_v0fwx") - -[node name="CollisionShape3D" parent="YSorted/HoeGenericPickup/PickupInteractionArea/Area2D" index="0"] -shape = SubResource("CircleShape2D_dr6bm") - -[node name="CanGenericPickup" parent="YSorted" instance=ExtResource("32_752hh")] -visible = false -position = Vector2(8192, 3507) - -[node name="SpawnWithItem" parent="YSorted/CanGenericPickup" index="0"] -_blueprint = ExtResource("29_6laxt") - -[node name="CollisionShape3D" parent="YSorted/CanGenericPickup/PickupInteractionArea/Area2D" index="0"] -shape = SubResource("CircleShape2D_34r5t") - -[node name="RakeGenericPickup" parent="YSorted" instance=ExtResource("32_752hh")] -visible = false -position = Vector2(8391, 2060) - -[node name="SpawnWithItem" parent="YSorted/RakeGenericPickup" index="0"] -_blueprint = ExtResource("28_le48k") - -[node name="CollisionShape3D" parent="YSorted/RakeGenericPickup/PickupInteractionArea/Area2D" index="0"] -shape = SubResource("CircleShape2D_hpgl7") - [node name="Farm visuals" type="Node2D" parent="YSorted"] position = Vector2(-60, 122) @@ -1758,113 +1690,124 @@ script = ExtResource("46_xkmgh") fields = {} metadata/_custom_type_script = "uid://dhxtdhfqx3bte" -[node name="BaseField" parent="YSorted/Farm visuals" instance=ExtResource("43_dr6bm")] -position = Vector2(447, 2597) +[node name="BaseField" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] +position = Vector2(651, 2630.26) +scale = Vector2(1, 1.00622) -[node name="BeetRoot" parent="YSorted/Farm visuals/BaseField/FieldBehaviour" index="1" node_paths=PackedStringArray("_smallPlants")] -_smallPlants = [NodePath("SmallPlant/01"), NodePath("SmallPlant/02"), null, null] +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField" index="0"] +FieldState = 3 -[node name="BeetSeet" parent="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot/Seeds" index="0"] -visible = true +[node name="BeetPlant" parent="YSorted/Farm visuals/FieldParent/BaseField/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_3kije")] +_state = 2 +_field = NodePath("../..") -[node name="01" parent="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot/BigPlant" index="0"] -visible = false +[node name="BaseField2" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] +position = Vector2(1226, 3098.15) +scale = Vector2(1, 1.00622) -[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"] -shape = SubResource("CircleShape2D_qavgq") +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField2" index="0"] +FieldState = 3 -[node name="BaseField2" parent="YSorted/Farm visuals" instance=ExtResource("43_dr6bm")] -position = Vector2(1230, 2590) +[node name="BeetPlant" parent="YSorted/Farm visuals/FieldParent/BaseField2/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_3kije")] +_state = 2 +_field = NodePath("../..") -[node name="BeetRoot" parent="YSorted/Farm visuals/BaseField2/FieldBehaviour" index="1" node_paths=PackedStringArray("_smallPlants")] -_smallPlants = [NodePath("SmallPlant/01"), NodePath("SmallPlant/02"), null, null] +[node name="BaseField3" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] +position = Vector2(1782, 2606.11) +scale = Vector2(1, 1.00622) -[node name="01" parent="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot/BigPlant" index="0"] -visible = false +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField3" index="0"] +FieldState = 3 -[node name="03" parent="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot/BigPlant" index="2"] -visible = true +[node name="BeetPlant" parent="YSorted/Farm visuals/FieldParent/BaseField3/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_3kije")] +_state = 2 +_field = NodePath("../..") -[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"] -shape = SubResource("CircleShape2D_njxly") +[node name="BaseField4" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] +position = Vector2(2559, 2624.22) +scale = Vector2(1, 1.00622) -[node name="BaseField3" parent="YSorted/Farm visuals" instance=ExtResource("43_dr6bm")] -position = Vector2(1994, 2603) +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField4" index="0"] +FieldState = 3 -[node name="BeetRoot" parent="YSorted/Farm visuals/BaseField3/FieldBehaviour" index="1" node_paths=PackedStringArray("_smallPlants")] -_smallPlants = [NodePath("SmallPlant/01"), NodePath("SmallPlant/02"), null, null] +[node name="BeetPlant" parent="YSorted/Farm visuals/FieldParent/BaseField4/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_3kije")] +_state = 2 +_field = NodePath("../..") -[node name="01" parent="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot/SmallPlant" index="0"] -visible = true +[node name="BaseField5" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] +position = Vector2(3305, 2624.22) +scale = Vector2(1, 1.00622) -[node name="01" parent="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot/BigPlant" index="0"] -visible = false - -[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"] -shape = SubResource("CircleShape2D_54ty3") - -[node name="BaseField4" parent="YSorted/Farm visuals" instance=ExtResource("43_dr6bm")] -position = Vector2(478, 3098) - -[node name="BeetRoot" parent="YSorted/Farm visuals/BaseField4/FieldBehaviour" index="1" node_paths=PackedStringArray("_smallPlants")] -_smallPlants = [NodePath("SmallPlant/01"), NodePath("SmallPlant/02"), null, null] - -[node name="BeetSeet3" parent="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot/Seeds" index="2"] -visible = true +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField5" index="0"] +FieldState = 3 -[node name="01" parent="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot/BigPlant" index="0"] -visible = false +[node name="BeetPlant" parent="YSorted/Farm visuals/FieldParent/BaseField5/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_3kije")] +_state = 2 +_field = NodePath("../..") -[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"] -shape = SubResource("CircleShape2D_gbxtf") +[node name="BaseField6" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] +position = Vector2(4033, 2618.18) +scale = Vector2(1, 1.00622) -[node name="BaseField5" parent="YSorted/Farm visuals" instance=ExtResource("43_dr6bm")] -position = Vector2(1279, 3123) +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField6" index="0"] +FieldState = 3 -[node name="BeetRoot" parent="YSorted/Farm visuals/BaseField5/FieldBehaviour" index="1" node_paths=PackedStringArray("_smallPlants")] -_smallPlants = [NodePath("SmallPlant/01"), NodePath("SmallPlant/02"), null, null] +[node name="BeetPlant" parent="YSorted/Farm visuals/FieldParent/BaseField6/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_3kije")] +_state = 2 +_field = NodePath("../..") -[node name="Seeds" parent="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot" index="0"] -visible = false +[node name="BaseField7" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] +position = Vector2(4755, 2630.26) +scale = Vector2(1, 1.00622) -[node name="01" parent="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot/BigPlant" index="0"] -visible = false +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField7" index="0"] +FieldState = 3 -[node name="02" parent="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot/BigPlant" index="1"] -visible = true +[node name="BeetPlant" parent="YSorted/Farm visuals/FieldParent/BaseField7/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_3kije")] +_state = 2 +_field = NodePath("../..") -[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"] -shape = SubResource("CircleShape2D_6krrk") +[node name="BaseField8" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] +position = Vector2(4418, 3226.95) +scale = Vector2(1, 1.00622) -[node name="BaseField6" parent="YSorted/Farm visuals" instance=ExtResource("43_dr6bm")] -position = Vector2(2037, 3135) +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField8" index="0"] +FieldState = 3 -[node name="BeetRoot" parent="YSorted/Farm visuals/BaseField6/FieldBehaviour" index="1" node_paths=PackedStringArray("_smallPlants")] -_smallPlants = [NodePath("SmallPlant/01"), NodePath("SmallPlant/02"), null, null] +[node name="BeetPlant" parent="YSorted/Farm visuals/FieldParent/BaseField8/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_3kije")] +_state = 2 +_field = NodePath("../..") -[node name="01" parent="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot/SmallPlant" index="0"] -visible = true +[node name="BaseField9" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] +position = Vector2(5317, 3208.83) +scale = Vector2(1, 1.00622) -[node name="01" parent="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot/BigPlant" index="0"] -visible = false +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField9" index="0"] +FieldState = 3 -[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"] -shape = SubResource("CircleShape2D_4ktoi") +[node name="BeetPlant" parent="YSorted/Farm visuals/FieldParent/BaseField9/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_3kije")] +_state = 2 +_field = NodePath("../..") [node name="Blocker" type="Node2D" parent="YSorted"] -[node name="Fence Door2" type="Sprite2D" parent="YSorted/Blocker"] +[node name="BackToFarm" parent="YSorted/Blocker" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("31_xcb8u")] +position = Vector2(3774, 2025) +_spriteToOutline = NodePath("Fence Door2") +_id = 0 + +[node name="Fence Door2" type="Sprite2D" parent="YSorted/Blocker/BackToFarm"] material = SubResource("ShaderMaterial_lwk6t") -position = Vector2(3788, 1563) +position = Vector2(60, -450) rotation = -0.0963081 scale = Vector2(0.903, 0.96) texture = ExtResource("47_xfjh2") -[node name="StaticBody2D" type="StaticBody2D" parent="YSorted/Blocker/Fence Door2"] +[node name="StaticBody2D" type="StaticBody2D" parent="YSorted/Blocker/BackToFarm/Fence Door2"] collision_layer = 2 collision_mask = 4 -[node name="CollisionShape2D" type="CollisionShape2D" parent="YSorted/Blocker/Fence Door2/StaticBody2D"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="YSorted/Blocker/BackToFarm/Fence Door2/StaticBody2D"] position = Vector2(-106.663, 182.891) shape = SubResource("RectangleShape2D_ycj14") @@ -1951,41 +1894,19 @@ script = ExtResource("58_m3hs4") [connection signal="FilledWateringCan" from="YSorted/Vesna" to="Audio/SFX/FillWater SFX2" method="PlayOneShot"] [connection signal="WateringField" from="YSorted/Vesna/FarmingControls" to="Audio/SFX/Watering SFX" method="PlayOneShot"] [connection signal="InteractedTool" from="YSorted/Brünnen/InteractionArea" to="YSorted/Vesna" method="TryFillWateringCan"] -[connection signal="SuccessfulPickUp" from="YSorted/CanGenericPickup" to="YSorted/Vesna" method="HandlePickUp"] -[connection signal="SuccessfulPickUp" from="YSorted/RakeGenericPickup" to="YSorted/Vesna" method="HandlePickUp"] [connection signal="FieldCreated" from="YSorted/Farm visuals/FieldParent" to="Audio/SFX/Farming SFX" method="PlayOneShot"] +[connection signal="InteractedTool" from="YSorted/Blocker/BackToFarm" to="." method="LoadSceneAtIndex"] [connection signal="finished" from="Audio/Background Music Ramp up" to="Audio/Background Music loop" method="PlayFromOffset"] [editable path="YSorted/Vesna"] [editable path="YSorted/Brünnen/InteractionArea"] -[editable path="YSorted/HoeGenericPickup"] -[editable path="YSorted/HoeGenericPickup/PickupInteractionArea"] -[editable path="YSorted/CanGenericPickup"] -[editable path="YSorted/CanGenericPickup/PickupInteractionArea"] -[editable path="YSorted/RakeGenericPickup"] -[editable path="YSorted/RakeGenericPickup/PickupInteractionArea"] -[editable path="YSorted/Farm visuals/BaseField"] -[editable path="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot"] -[editable path="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem"] -[editable path="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea"] -[editable path="YSorted/Farm visuals/BaseField2"] -[editable path="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot"] -[editable path="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem"] -[editable path="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea"] -[editable path="YSorted/Farm visuals/BaseField3"] -[editable path="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot"] -[editable path="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem"] -[editable path="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea"] -[editable path="YSorted/Farm visuals/BaseField4"] -[editable path="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot"] -[editable path="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem"] -[editable path="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea"] -[editable path="YSorted/Farm visuals/BaseField5"] -[editable path="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot"] -[editable path="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem"] -[editable path="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea"] -[editable path="YSorted/Farm visuals/BaseField6"] -[editable path="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot"] -[editable path="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem"] -[editable path="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField2"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField3"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField4"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField5"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField6"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField7"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField8"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField9"] [editable path="CanvasLayer"] diff --git a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs index 60ffd13..6a3439a 100644 --- a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs +++ b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs @@ -36,24 +36,35 @@ public partial class PlantBehaviour2D : Node2D } public override void _Ready() + { + if (_state == PlantState.None) + { + GetTree().CallGroup("PlantGrowing", VesnaAnimations.MethodName.PlayFarmingAnimation); + _state = PlantState.Planted; + _currentPlantSprite = GetRandomSprite(_seeds); + _currentPlantSprite.Visible = true; + } + else + { + GrowPlant(); + } + } + + public void Grow() { GetTree().CallGroup("PlantGrowing", VesnaAnimations.MethodName.PlayFarmingAnimation); - _state = PlantState.Planted; - _currentPlantSprite = GetRandomSprite(_seeds); - _currentPlantSprite.Visible = true; + GrowPlant(); } /// /// Transitions the plant to its next growth stage. /// - public void Grow() + public void GrowPlant() { if (_field.FieldState != FieldState.Watered || _magicWordSaid != _magicWordNeeded) return; - // todo: replace with EventBus when possible - GetTree().CallGroup("PlantGrowing", VesnaAnimations.MethodName.PlayFarmingAnimation); switch (_state) { case PlantState.None: @@ -63,26 +74,30 @@ public partial class PlantBehaviour2D : Node2D break; case PlantState.Planted: _state = PlantState.SmallPlant; - _currentPlantSprite.Visible = false; + if(_currentPlantSprite != null) + _currentPlantSprite.Visible = false; _currentPlantSprite = GetRandomSprite(_smallPlants); _currentPlantSprite.Visible = true; break; case PlantState.SmallPlant: _state = PlantState.BigPlant; - _currentPlantSprite.Visible = false; + if(_currentPlantSprite != null) + _currentPlantSprite.Visible = false; _currentPlantSprite = GetRandomSprite(_bigPlants); _currentPlantSprite.Visible = true; break; case PlantState.BigPlant: _state = PlantState.Ready; - _currentPlantSprite.Visible = false; + if(_currentPlantSprite != null) + _currentPlantSprite.Visible = false; _currentPlantSprite = GetRandomSprite(_readyPlants); _currentPlantSprite.Visible = true; ActivatePickupAfterDelay(true); break; case PlantState.Ready: _state = PlantState.None; - _currentPlantSprite.Visible = false; + if(_currentPlantSprite != null) + _currentPlantSprite.Visible = false; _currentPlantSprite = null; ActivatePickupAfterDelay(false); break;