diff --git a/.idea/.idea.Babushka/.idea/libraries/GdSdk.xml b/.idea/.idea.Babushka/.idea/libraries/GdSdk.xml new file mode 100644 index 0000000..0059883 --- /dev/null +++ b/.idea/.idea.Babushka/.idea/libraries/GdSdk.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Babushka/.idea/libraries/GdSdk_Master.xml b/.idea/.idea.Babushka/.idea/libraries/GdSdk_Master.xml deleted file mode 100644 index 8b941bb..0000000 --- a/.idea/.idea.Babushka/.idea/libraries/GdSdk_Master.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/Babushka.sln.DotSettings.user b/Babushka.sln.DotSettings.user index cc77894..d333d51 100644 --- a/Babushka.sln.DotSettings.user +++ b/Babushka.sln.DotSettings.user @@ -17,6 +17,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded diff --git a/art/masks/field_outline_1_outline.png b/art/masks/field_outline_1_outline.png new file mode 100644 index 0000000..ba71a6c Binary files /dev/null and b/art/masks/field_outline_1_outline.png differ diff --git a/art/masks/field_outline_1_outline.png.import b/art/masks/field_outline_1_outline.png.import new file mode 100644 index 0000000..85ab6b3 --- /dev/null +++ b/art/masks/field_outline_1_outline.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bovypw2hsn2nq" +path="res://.godot/imported/field_outline_1_outline.png-45f43538274c8b9489711c885b999170.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/masks/field_outline_1_outline.png" +dest_files=["res://.godot/imported/field_outline_1_outline.png-45f43538274c8b9489711c885b999170.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +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 diff --git a/art/masks/field_outline_2_outline.png b/art/masks/field_outline_2_outline.png new file mode 100644 index 0000000..77987e2 Binary files /dev/null and b/art/masks/field_outline_2_outline.png differ diff --git a/art/masks/field_outline_2_outline.png.import b/art/masks/field_outline_2_outline.png.import new file mode 100644 index 0000000..a7584d7 --- /dev/null +++ b/art/masks/field_outline_2_outline.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://50qn027e5lvh" +path="res://.godot/imported/field_outline_2_outline.png-866d5c097a49b7c63eee72f4455558ee.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/masks/field_outline_2_outline.png" +dest_files=["res://.godot/imported/field_outline_2_outline.png-866d5c097a49b7c63eee72f4455558ee.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +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 diff --git a/art/masks/field_outline_3_outline.png b/art/masks/field_outline_3_outline.png new file mode 100644 index 0000000..ccb2b3a Binary files /dev/null and b/art/masks/field_outline_3_outline.png differ diff --git a/art/masks/field_outline_3_outline.png.import b/art/masks/field_outline_3_outline.png.import new file mode 100644 index 0000000..1d3889e --- /dev/null +++ b/art/masks/field_outline_3_outline.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://wjtvno2jj4nl" +path="res://.godot/imported/field_outline_3_outline.png-00e4af97c20bd898c6461491100baa4e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/masks/field_outline_3_outline.png" +dest_files=["res://.godot/imported/field_outline_3_outline.png-00e4af97c20bd898c6461491100baa4e.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +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 diff --git a/dialog/translations/dialogic_character_translations.en.translation-qwtWdW b/dialog/translations/dialogic_character_translations.en.translation-qwtWdW new file mode 100644 index 0000000..e69de29 diff --git a/dialog/translations/dialogic_semi_cat_translation.en.translation-Br5qQE b/dialog/translations/dialogic_semi_cat_translation.en.translation-Br5qQE new file mode 100644 index 0000000..e69de29 diff --git a/dialog/translations/dialogic_test_time_line_translation.en.translation-q1xYHQ b/dialog/translations/dialogic_test_time_line_translation.en.translation-q1xYHQ new file mode 100644 index 0000000..e69de29 diff --git a/prefabs/Interactables/inventory_dependent_interactable_test.tscn b/prefabs/Interactables/inventory_dependent_interactable_test.tscn index ae82d35..357b7f2 100644 --- a/prefabs/Interactables/inventory_dependent_interactable_test.tscn +++ b/prefabs/Interactables/inventory_dependent_interactable_test.tscn @@ -10,9 +10,8 @@ script = ExtResource("1_cu47d") _interactionArea = NodePath("InteractionArea") _itemsToReactTo = Array[Object]([ExtResource("2_s5peo")]) -[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("3_wsetd")] -_active = false -_spriteToOutline = NodePath("../Sprite2D") +[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("3_wsetd")] +_spritesToOutline = [NodePath("../Sprite2D")] [node name="Sprite2D" type="Sprite2D" parent="."] scale = Vector2(0.5, 0.5) diff --git a/prefabs/Interactables/trash_object.tscn b/prefabs/Interactables/trash_object.tscn index 190183e..a5fc1bf 100644 --- a/prefabs/Interactables/trash_object.tscn +++ b/prefabs/Interactables/trash_object.tscn @@ -1,8 +1,7 @@ -[gd_scene load_steps=16 format=3 uid="uid://sbf12hin4kes"] +[gd_scene load_steps=17 format=3 uid="uid://sbf12hin4kes"] [ext_resource type="Texture2D" uid="uid://bylgmr0skwtrs" path="res://art/farm/farming/farmobjekte/broken tools atlas.png" id="1_k4ca3"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="2_gcgfd"] -[ext_resource type="Script" uid="uid://dkk1vjijvgrd7" path="res://scripts/CSharp/Common/Items/NonInventoryPickup.cs" id="2_ic616"] [ext_resource type="AudioStream" uid="uid://be6g8b3v3u1ai" path="res://audio/sfx/Kitchen/SFX_Cooking_Knife_PickUp_01.wav" id="3_ktmp7"] [ext_resource type="AudioStream" uid="uid://cgjsajsdrrn0j" path="res://audio/sfx/Kitchen/SFX_Cooking_Knife_PutDown_01.wav" id="4_ic616"] [ext_resource type="AudioStream" uid="uid://br4drgupled6c" path="res://audio/sfx/Kitchen/SFX_Cooking_Pot_01.wav" id="5_dx175"] @@ -14,6 +13,8 @@ [ext_resource type="AudioStream" uid="uid://bc216pfieuc8h" path="res://audio/sfx/Kitchen/SFX_Cutlery_04.wav" id="11_kb03l"] [ext_resource type="AudioStream" uid="uid://dp6qen84ptlvx" path="res://audio/sfx/Kitchen/SFX_Cutlery_05.wav" id="12_kka6u"] [ext_resource type="Script" uid="uid://cfnrd5k1k0gxw" path="res://scripts/CSharp/Common/AudioPlayer2D.cs" id="13_wswkg"] +[ext_resource type="Script" uid="uid://b5dotkx17gvxg" path="res://scripts/CSharp/Low Code/Events/EventRaiser.cs" id="14_dx175"] +[ext_resource type="Resource" uid="uid://78t0o27g6aq6" path="res://resources/low code/interactables/event_PickedUpInteractable.tres" id="15_u7jgg"] [sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_dich4"] streams_count = 10 @@ -35,11 +36,10 @@ texture = ExtResource("1_k4ca3") offset = Vector2(1, -215) region_enabled = true region_rect = Rect2(44, 479, 356, 503) -script = ExtResource("2_ic616") -[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("2_gcgfd")] +[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("2_gcgfd")] position = Vector2(0, -172) -_spriteToOutline = NodePath("..") +_spritesToOutline = [NodePath("..")] [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] stream = SubResource("AudioStreamRandomizer_dich4") @@ -47,6 +47,10 @@ bus = &"SFX" playback_type = 2 script = ExtResource("13_wswkg") +[node name="PickupAnimationEventRaiser" type="Node" parent="."] +script = ExtResource("14_dx175") +_eventResources = Array[Object]([ExtResource("15_u7jgg")]) + [connection signal="Interacted" from="InteractionArea" to="." method="queue_free"] -[connection signal="Interacted" from="InteractionArea" to="." method="PlayPickupAnimation"] [connection signal="Interacted" from="InteractionArea" to="AudioStreamPlayer2D" method="PlayOneShot"] +[connection signal="Interacted" from="InteractionArea" to="PickupAnimationEventRaiser" method="RaiseEvents"] diff --git a/prefabs/characters/Chugar.tscn b/prefabs/characters/Chugar.tscn index 6bf8903..581e735 100644 --- a/prefabs/characters/Chugar.tscn +++ b/prefabs/characters/Chugar.tscn @@ -1,9 +1,8 @@ -[gd_scene load_steps=9 format=3 uid="uid://ddpl8cbck7e6s"] +[gd_scene load_steps=8 format=3 uid="uid://ddpl8cbck7e6s"] [ext_resource type="Script" uid="uid://d0kgxh4ykuv23" path="res://scripts/CSharp/Common/NPC/TalkingCharacter.cs" id="1_xix7p"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="2_udjjv"] [ext_resource type="Texture2D" uid="uid://bgba1uv0muxat" path="res://art/characters/chugeist_tmp.png" id="3_42og6"] -[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/simple_interactable_outline.tres" id="3_kd44q"] [ext_resource type="Script" uid="uid://d2486x6upmwqq" path="res://scripts/GdScript/dialogic_starter.gd" id="43_xooq4"] [ext_resource type="Script" uid="uid://cvkw4qd2hxksi" path="res://scripts/GdScript/dialogic_toggle.gd" id="44_v6w16"] @@ -21,11 +20,10 @@ z_index = 1 y_sort_enabled = true script = ExtResource("1_xix7p") -[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("2_udjjv")] +[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("2_udjjv")] position = Vector2(0, -450) scale = Vector2(2.805, 2.805) -_outlineMaterial = ExtResource("3_kd44q") -_spriteToOutline = NodePath("../TalkingControl/Visual") +_spritesToOutline = [NodePath("../TalkingControl/Visual")] [node name="CollisionShape3D" parent="InteractionArea/Area2D" index="0"] position = Vector2(-4.99109, 63.4581) diff --git a/prefabs/characters/Player2D.tscn b/prefabs/characters/Player2D.tscn index 4e36931..cff4237 100644 --- a/prefabs/characters/Player2D.tscn +++ b/prefabs/characters/Player2D.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=482 format=3 uid="uid://c25udixd5m6l0"] +[gd_scene load_steps=485 format=3 uid="uid://c25udixd5m6l0"] [ext_resource type="Script" uid="uid://b05uyj001ehwi" path="res://scripts/CSharp/Common/Farming/VesnaBehaviour2D.cs" id="1_yd5ep"] [ext_resource type="Script" uid="uid://cjbclkxesh3hc" path="res://scripts/CSharp/Common/CharacterControls/PlayerMovement.cs" id="2_1vqmv"] @@ -272,16 +272,19 @@ [ext_resource type="Texture2D" uid="uid://vahac0df0dhj" path="res://art/animation/Vesna2D/Vesna Anims Tools/F01-Idle-Gießkanne/0008.png" id="464_pbc3r"] [ext_resource type="PackedScene" uid="uid://pflu0uaig7vv" path="res://prefabs/interactions/detection_cross.tscn" id="466_e04c3"] [ext_resource type="Texture2D" uid="uid://b37lpqrsjjuc0" path="res://art/animation/Vesna2D/Vesna Anims Tools/F01-Idle-Gießkanne/0010.png" id="466_pw1ip"] +[ext_resource type="Script" uid="uid://bc6uaaxsx5k5p" path="res://scripts/CSharp/Low Code/Events/EventListener.cs" id="467_8hbu5"] [ext_resource type="Script" uid="uid://er03dkj8axlr" path="res://scripts/CSharp/Common/UI/WateringCanUi.cs" id="467_j4m0f"] [ext_resource type="Texture2D" uid="uid://oi11ax6tml6j" path="res://art/animation/Vesna2D/Vesna Anims Tools/F01-Idle-Gießkanne/0012.png" id="468_08021"] +[ext_resource type="Resource" uid="uid://b4hawvsc7cmkn" path="res://resources/low code/farming/event_newPlantCreated.tres" id="468_t1d6r"] +[ext_resource type="Resource" uid="uid://78t0o27g6aq6" path="res://resources/low code/interactables/event_PickedUpInteractable.tres" id="469_t1d6r"] [ext_resource type="Texture2D" uid="uid://dsjj23763pej5" path="res://art/animation/Vesna2D/Vesna Anims Tools/F01-Idle-Gießkanne/0014.png" id="470_bmmei"] [ext_resource type="AudioStream" uid="uid://ce5mxs2yrwgrh" path="res://audio/sfx/Footsteps/Single/Gravel/Reverb/SFX_Footstep_Gravel_01_R.wav" id="470_dnm27"] [ext_resource type="Script" uid="uid://dx25g14a7xi4w" path="res://scripts/CSharp/Common/Audio/AudioPlayer.cs" id="471_2f15g"] +[ext_resource type="Resource" uid="uid://tt3d166mntmi" path="res://resources/low code/farming/var_sceneNameProvider.tres" id="471_83c4i"] [ext_resource type="AudioStream" uid="uid://fihv17va3r58" path="res://audio/sfx/Footsteps/Single/Gravel/Reverb/SFX_Footstep_Gravel_02_R.wav" id="471_e04c3"] [ext_resource type="AudioStream" uid="uid://cvvjd2i6x047n" path="res://audio/sfx/Footsteps/Single/Gravel/Reverb/SFX_Footstep_Gravel_03_R.wav" id="472_g32y8"] [ext_resource type="Texture2D" uid="uid://blh0t2ofqj2uq" path="res://art/animation/Vesna2D/Vesna Anims Tools/F01-Idle-Gießkanne/0016.png" id="472_wdxsr"] [ext_resource type="AudioStream" uid="uid://dymoalptxmge" path="res://audio/sfx/Footsteps/Single/Gravel/Reverb/SFX_Footstep_Gravel_04_R.wav" id="473_8hbu5"] -[ext_resource type="Texture2D" uid="uid://l5ym7gi82l1b" path="res://art/ui/UI/Watercan-ui/Tropfen-ui-6.png" id="473_g32y8"] [ext_resource type="AudioStream" uid="uid://4555a4w30tda" path="res://audio/sfx/Footsteps/Single/Gravel/Reverb/SFX_Footstep_Gravel_05_R.wav" id="474_t1d6r"] [ext_resource type="Texture2D" uid="uid://3t1m2xi4ks75" path="res://art/animation/Vesna2D/Vesna Anims Tools/F01-Idle-Gießkanne/0018.png" id="474_tu801"] [ext_resource type="AudioStream" uid="uid://dpqvnogggvgea" path="res://audio/sfx/Footsteps/Single/Gravel/Reverb/SFX_Footstep_Gravel_06_R.wav" id="475_83c4i"] @@ -290,6 +293,7 @@ [ext_resource type="Texture2D" uid="uid://d3rdsclnqbx7" path="res://art/animation/Vesna2D/Vesna Anims Sequences/F02-Walk/0001.png" id="477_qko58"] [ext_resource type="Texture2D" uid="uid://dqubvx1a08kn4" path="res://art/animation/Vesna2D/Vesna Anims Sequences/F02-Walk/0002.png" id="478_5myrm"] [ext_resource type="Texture2D" uid="uid://dystt4hyqad74" path="res://art/animation/Vesna2D/Vesna Anims Sequences/F02-Walk/0004.png" id="480_wnay3"] +[ext_resource type="Resource" uid="uid://cmqapbvv0hev2" path="res://resources/low code/farming/event_watering.tres" id="481_t1d6r"] [ext_resource type="Texture2D" uid="uid://bopxv06co1osl" path="res://art/animation/Vesna2D/Vesna Anims Sequences/F02-Walk/0006.png" id="482_wfdif"] [ext_resource type="Texture2D" uid="uid://coyggdfwgkeru" path="res://art/animation/Vesna2D/Vesna Anims Sequences/F02-Walk/0008.png" id="484_32thn"] [ext_resource type="Texture2D" uid="uid://du6x1h42smp6m" path="res://art/animation/Vesna2D/Vesna Anims Sequences/F02-Walk/0010.png" id="486_kobao"] @@ -476,7 +480,6 @@ [ext_resource type="Texture2D" uid="uid://b0v61all3tsny" path="res://art/animation/Vesna2D/Vesna Anims Tools/S02-Walk-Gießkanne/0018.png" id="812_sf8kv"] [ext_resource type="Texture2D" uid="uid://cao7vqax8cblo" path="res://art/animation/Vesna2D/Vesna Anims Tools/S02-Walk-Gießkanne/0020.png" id="814_3uq4g"] [ext_resource type="Script" uid="uid://bcskt5ckh3rqa" path="res://scripts/CSharp/Common/Farming/FarmingControls2D.cs" id="817_6nrw3"] -[ext_resource type="PackedScene" uid="uid://b1d2e7ely6hyw" path="res://prefabs/farm/base_field.tscn" id="818_16w6h"] [ext_resource type="Script" uid="uid://cvkw4qd2hxksi" path="res://scripts/GdScript/dialogic_toggle.gd" id="819_4na52"] [sub_resource type="CircleShape2D" id="CircleShape2D_ssqtd"] @@ -2103,11 +2106,10 @@ position = Vector2(-24, -13) shape = SubResource("CircleShape2D_ssqtd") debug_color = Color(0.923708, 0.202722, 0.475262, 0.42) -[node name="visuals" type="Node2D" parent="CharacterBody2D" node_paths=PackedStringArray("_sprite", "_wateringParticles") groups=["Pickup", "PlantGrowing"]] +[node name="visuals" type="Node2D" parent="CharacterBody2D" node_paths=PackedStringArray("_sprite")] position = Vector2(0, -374) script = ExtResource("3_f6xmn") _sprite = NodePath("Animated Sprites") -_wateringParticles = NodePath("../../pouring water vfx") [node name="Animated Sprites" type="AnimatedSprite2D" parent="CharacterBody2D/visuals"] position = Vector2(0, 450) @@ -2142,35 +2144,20 @@ scrollable = false [node name="DetectionCross" parent="CharacterBody2D" instance=ExtResource("466_e04c3")] position = Vector2(0, -200) -[node name="FarmingControls" type="Node2D" parent="." node_paths=PackedStringArray("_movingPlayer", "_wateringParticles")] +[node name="PlantCreatedEventListener" type="Node" parent="CharacterBody2D"] +script = ExtResource("467_8hbu5") +_eventResources = Array[Object]([ExtResource("468_t1d6r")]) + +[node name="PickedUpInteractableListener" type="Node" parent="CharacterBody2D"] +script = ExtResource("467_8hbu5") +_eventResources = Array[Object]([ExtResource("469_t1d6r")]) + +[node name="FarmingControls" type="Node2D" parent="." node_paths=PackedStringArray("_movingPlayer")] script = ExtResource("817_6nrw3") -_fieldPrefab = ExtResource("818_16w6h") +_sceneKeyProvider = ExtResource("471_83c4i") _movingPlayer = NodePath("../CharacterBody2D") -_wateringParticles = NodePath("../pouring water vfx") _wateringCanParticlesVerticalOffset = -100.0 - -[node name="dialogic toggle" type="Node2D" parent="."] -position = Vector2(0, 374) -script = ExtResource("819_4na52") - -[node name="pouring water vfx" type="CPUParticles2D" parent="."] -position = Vector2(-652, -599) -rotation = -0.333807 -emitting = false -amount = 20 -texture = ExtResource("473_g32y8") -lifetime = 0.5 -randomness = 1.0 -local_coords = true -draw_order = 1 -emission_shape = 2 -emission_sphere_radius = 128.0 -linear_accel_min = 44.07 -linear_accel_max = 78.81 -scale_amount_min = 0.4 -scale_amount_max = 0.8 -color = Color(0.400601, 0.62444, 0.791217, 1) -hue_variation_max = 0.4 +_fieldOffsetVector = Vector2i(735, 600) [node name="DialogicToggle" type="Node2D" parent="." node_paths=PackedStringArray("itemToToggle")] scale = Vector2(0.7, 0.7) @@ -2187,14 +2174,18 @@ script = ExtResource("471_2f15g") [node name="Timer" type="Timer" parent="SFX/FootstepsAudio"] wait_time = 0.5 +[node name="WateringEventListener" type="Node" parent="."] +script = ExtResource("467_8hbu5") +_eventResources = Array[Object]([ExtResource("481_t1d6r")]) + [connection signal="FilledWateringCan" from="." to="CharacterBody2D/WateringCanUI" method="Refill"] [connection signal="InventorySelectionChanged" from="." to="CharacterBody2D/WateringCanUI" method="IsWateringCanActive"] [connection signal="PickedUpTool" from="." to="CharacterBody2D/visuals" method="ActivateTool"] [connection signal="PickedUpTool" from="." to="CharacterBody2D/WateringCanUI" method="IsWateringCanActive"] [connection signal="LookDirection" from="CharacterBody2D/visuals" to="CharacterBody2D/DetectionCross" method="SetDirection"] -[connection signal="WateringField" from="FarmingControls" to="CharacterBody2D/visuals" method="PlayWateringAnimation"] -[connection signal="WateringField" from="FarmingControls" to="CharacterBody2D/WateringCanUI" method="Water"] -[connection signal="timelineEnded" from="dialogic toggle" to="." method="EnableMovement"] -[connection signal="timelineStarted" from="dialogic toggle" to="." method="DisableMovement"] +[connection signal="EventRaised" from="CharacterBody2D/PlantCreatedEventListener" to="CharacterBody2D/visuals" method="PlayFarmingAnimation"] +[connection signal="EventRaised" from="CharacterBody2D/PickedUpInteractableListener" to="CharacterBody2D/visuals" method="PlayPickUpAnimation"] [connection signal="timelineStarted" from="DialogicToggle" to="SFX/FootstepsAudio/Timer" method="stop"] [connection signal="timeout" from="SFX/FootstepsAudio/Timer" to="SFX/FootstepsAudio" method="PlayOneShot"] +[connection signal="EventRaised" from="WateringEventListener" to="CharacterBody2D/visuals" method="PlayWateringAnimation"] +[connection signal="EventRaised" from="WateringEventListener" to="CharacterBody2D/WateringCanUI" method="Water"] diff --git a/prefabs/characters/Yeli.tscn b/prefabs/characters/Yeli.tscn index 2e4ac29..d32fd51 100644 --- a/prefabs/characters/Yeli.tscn +++ b/prefabs/characters/Yeli.tscn @@ -206,9 +206,9 @@ y_sort_enabled = true script = ExtResource("1_hn8at") _sprite = NodePath("TalkingControl/AnimatedSprite") -[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("42_ahrat")] +[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("42_ahrat")] position = Vector2(0, -450) -_spriteToOutline = NodePath("../TalkingControl/AnimatedSprite") +_spritesToOutline = [NodePath("../TalkingControl/AnimatedSprite")] [node name="CollisionShape3D" parent="InteractionArea/Area2D" index="0"] shape = SubResource("CircleShape2D_at1n1") diff --git a/prefabs/farm/animals/duck.tscn b/prefabs/farm/animals/duck.tscn index 042f9e0..d3c0ff5 100644 --- a/prefabs/farm/animals/duck.tscn +++ b/prefabs/farm/animals/duck.tscn @@ -160,9 +160,9 @@ libraries = { &"": SubResource("AnimationLibrary_54k4r") } -[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("15_uo3dh")] +[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("15_uo3dh")] position = Vector2(18, -250) -_spriteToOutline = NodePath("../Duck rendered") +_spritesToOutline = [NodePath("../Duck rendered")] [node name="CollisionShape3D" parent="InteractionArea/Area2D" index="0"] shape = SubResource("CircleShape2D_uo3dh") diff --git a/prefabs/farm/base_field.tscn b/prefabs/farm/base_field.tscn index ab21577..f000cf4 100644 --- a/prefabs/farm/base_field.tscn +++ b/prefabs/farm/base_field.tscn @@ -1,28 +1,65 @@ -[gd_scene load_steps=9 format=3 uid="uid://b1d2e7ely6hyw"] +[gd_scene load_steps=25 format=3 uid="uid://b1d2e7ely6hyw"] +[ext_resource type="Script" uid="uid://j2mhvb45egej" path="res://scripts/CSharp/Low Code/Variables/VariableNode.cs" id="1_4mg73"] [ext_resource type="Script" uid="uid://bdffon388rkty" path="res://scripts/CSharp/Common/Farming/FieldBehaviour2D.cs" id="1_qa01x"] [ext_resource type="Texture2D" uid="uid://cgmu3qlovdr22" path="res://art/masks/field_outline_1.png" id="2_w8caw"] +[ext_resource type="Texture2D" uid="uid://50qn027e5lvh" path="res://art/masks/field_outline_2_outline.png" id="3_2eegd"] [ext_resource type="Texture2D" uid="uid://eg5ej0mtuac" path="res://art/masks/field_outline_2.png" id="3_c014y"] +[ext_resource type="Texture2D" uid="uid://wjtvno2jj4nl" path="res://art/masks/field_outline_3_outline.png" id="4_svbd7"] [ext_resource type="Texture2D" uid="uid://djpigvoyadvjs" path="res://art/masks/field_outline_3.png" id="4_teirr"] [ext_resource type="Texture2D" uid="uid://c2pirgay3jfnn" path="res://art/farm/tilable grounds/böden/trockene farming erde.png" id="5_wx561"] [ext_resource type="Texture2D" uid="uid://ctvdxwgmfaj5c" path="res://art/farm/tilable grounds/böden/nasse farming erde.png" id="6_7m4xq"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="7_2eegd"] [ext_resource type="Resource" uid="uid://d284vxftxhym0" path="res://resources/itemRepository.tres" id="7_w8caw"] +[ext_resource type="Script" uid="uid://b5dotkx17gvxg" path="res://scripts/CSharp/Low Code/Events/EventRaiser.cs" id="9_teirr"] +[ext_resource type="Texture2D" uid="uid://bovypw2hsn2nq" path="res://art/masks/field_outline_1_outline.png" id="9_wx561"] +[ext_resource type="Resource" uid="uid://b4hawvsc7cmkn" path="res://resources/low code/farming/event_newPlantCreated.tres" id="10_wx561"] +[ext_resource type="Resource" uid="uid://tt3d166mntmi" path="res://resources/low code/farming/var_sceneNameProvider.tres" id="11_cjahb"] +[ext_resource type="Resource" uid="uid://cmqapbvv0hev2" path="res://resources/low code/farming/event_watering.tres" id="14_57jmp"] +[ext_resource type="Script" uid="uid://3t0af586fimq" path="res://scripts/CSharp/Common/Inventory/InventoryListener.cs" id="14_w08sx"] +[ext_resource type="Resource" uid="uid://d1uuxp1lp4aro" path="res://resources/items/tomato_seed.tres" id="15_i4qwg"] +[ext_resource type="Resource" uid="uid://duq7tshxv6uhp" path="res://resources/items/beet_seed.tres" id="16_i4qwg"] +[ext_resource type="Resource" uid="uid://cndd64batns31" path="res://resources/items/wateringcan.tres" id="17_1mi0u"] +[ext_resource type="Texture2D" uid="uid://l5ym7gi82l1b" path="res://art/ui/UI/Watercan-ui/Tropfen-ui-6.png" id="21_4mg73"] +[ext_resource type="Resource" uid="uid://dlcmqfjvgphqu" path="res://resources/items/rake.tres" id="21_68xcd"] +[ext_resource type="Script" uid="uid://dlbjjgbs0n4b0" path="res://scripts/CSharp/Common/Farming/FieldActivator.cs" id="22_57jmp"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_57jmp"] +resource_local_to_scene = true +radius = 325.2599 [node name="BaseField" type="Node2D"] +script = ExtResource("1_4mg73") +Payload = 0 + +[node name="OutlineSprite" type="Sprite2D" parent="."] +self_modulate = Color(1, 1, 1, 0) +z_index = 1 +scale = Vector2(1.3499999, 1.5) +texture = ExtResource("9_wx561") -[node name="FieldBehaviour" type="Sprite2D" parent="." node_paths=PackedStringArray("_fieldSprite", "_maskSprite", "PlantingInteraction", "PlantingPlaceholder")] +[node name="FieldBehaviour" type="Sprite2D" parent="." node_paths=PackedStringArray("_fieldIndex", "_fieldSprite", "_maskSprite", "_outlineSprite", "PlantingInteraction", "FieldInteractionArea", "PlantingPlaceholder", "_wateringParticles")] +visible = false z_index = -1 scale = Vector2(0.9, 1) script = ExtResource("1_qa01x") +SaveId = "field" +_fieldIndex = NodePath("..") +_sceneKeyProvider = ExtResource("11_cjahb") +FieldState = 0 _fieldSprite = NodePath("MaskedField/FieldTexture") _maskSprite = NodePath("MaskedField") +_outlineSprite = NodePath("../OutlineSprite") +_maskOutlineTextures = Array[Texture2D]([ExtResource("9_wx561"), ExtResource("3_2eegd"), ExtResource("4_svbd7")]) _maskTexture = Array[Texture2D]([ExtResource("2_w8caw"), ExtResource("3_c014y"), ExtResource("4_teirr")]) Tilled = ExtResource("5_wx561") Watered = ExtResource("6_7m4xq") -PlantingInteraction = NodePath("../InteractionArea") +PlantingInteraction = NodePath("InteractionArea") +FieldInteractionArea = NodePath("InteractionArea") PlantingPlaceholder = NodePath("PlantPlaceholder") ItemRepository = ExtResource("7_w8caw") +_wateringParticles = NodePath("../pouring water vfx") +_wateringEvent = ExtResource("14_57jmp") [node name="MaskedField" type="Sprite2D" parent="FieldBehaviour"] clip_children = 1 @@ -34,9 +71,68 @@ texture = ExtResource("5_wx561") [node name="PlantPlaceholder" type="Node2D" parent="FieldBehaviour"] -[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("7_2eegd")] -position = Vector2(-16, -54) +[node name="InteractionArea" parent="FieldBehaviour" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("7_2eegd")] +position = Vector2(-28.88889, -57) +scale = Vector2(1.1111112, 1) _active = false -_spriteToOutline = NodePath("../FieldBehaviour/MaskedField/FieldTexture") +_spritesToOutline = [NodePath("../../OutlineSprite")] +_showLabel = false + +[node name="PlantCreationEventRaiser" type="Node" parent="."] +script = ExtResource("9_teirr") +_eventResources = Array[Object]([ExtResource("10_wx561")]) + +[node name="InventoryListener Seeds" type="Node" parent="."] +script = ExtResource("14_w08sx") +_itemResourcesToListenFor = Array[Object]([ExtResource("15_i4qwg"), ExtResource("16_i4qwg")]) + +[node name="InventoryListener watering can" type="Node" parent="."] +script = ExtResource("14_w08sx") +_itemResourcesToListenFor = Array[Object]([ExtResource("17_1mi0u")]) + +[node name="InventoryListener rake" type="Node" parent="."] +script = ExtResource("14_w08sx") +_itemResourcesToListenFor = Array[Object]([ExtResource("21_68xcd")]) + +[node name="pouring water vfx" type="CPUParticles2D" parent="."] +position = Vector2(0, -300) +emitting = false +amount = 25 +texture = ExtResource("21_4mg73") +one_shot = true +randomness = 1.0 +local_coords = true +draw_order = 1 +emission_shape = 2 +emission_sphere_radius = 128.0 +gravity = Vector2(0, 500) +linear_accel_min = 44.07 +linear_accel_max = 78.81 +scale_amount_min = 0.4 +scale_amount_max = 0.8 +color = Color(0.400601, 0.62444, 0.791217, 1) +hue_variation_max = 0.4 + +[node name="FieldActivator" type="Node2D" parent="." node_paths=PackedStringArray("_field", "_activatorArea")] +script = ExtResource("22_57jmp") +_field = NodePath("../FieldBehaviour") +_activatorArea = NodePath("InteractionArea") + +[node name="InteractionArea" parent="FieldActivator" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("7_2eegd")] +_spritesToOutline = [NodePath("../../OutlineSprite")] + +[node name="CollisionShape3D" parent="FieldActivator/InteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_57jmp") + +[node name="Marker2D" type="Marker2D" parent="."] +gizmo_extents = 157.0 + +[connection signal="Planted" from="FieldBehaviour" to="PlantCreationEventRaiser" method="RaiseEvents"] +[connection signal="Interacted" from="FieldBehaviour/InteractionArea" to="FieldBehaviour" method="Farm"] +[connection signal="ItemInstanceActivated" from="InventoryListener Seeds" to="FieldBehaviour" method="ActivatedSeedInInventory"] +[connection signal="ItemInstanceActivated" from="InventoryListener watering can" to="FieldBehaviour" method="ActivateWateringCanInInventory"] +[connection signal="ItemInstanceActivated" from="InventoryListener rake" to="FieldActivator" method="RakeActivated"] +[connection signal="Interacted" from="FieldActivator/InteractionArea" to="FieldActivator" method="ActivateField"] +[connection signal="Interacted" from="FieldActivator/InteractionArea" to="FieldActivator/InteractionArea" method="ToggleActive"] -[connection signal="Interacted" from="InteractionArea" to="FieldBehaviour" method="Farm"] +[editable path="FieldActivator/InteractionArea"] diff --git a/prefabs/farm/plants/base_plant.tscn b/prefabs/farm/plants/base_plant.tscn index 0b9ea30..d20e588 100644 --- a/prefabs/farm/plants/base_plant.tscn +++ b/prefabs/farm/plants/base_plant.tscn @@ -38,7 +38,6 @@ _bigPlants = [NodePath("BigPlant/01"), NodePath("BigPlant/02"), NodePath("BigPla _readyPlants = [NodePath("ReadyPlantInventoryItem/ReadyPlant/01"), NodePath("ReadyPlantInventoryItem/ReadyPlant/02"), NodePath("ReadyPlantInventoryItem/ReadyPlant/03")] _harvestablePlant = NodePath("ReadyPlantInventoryItem") _magicEffect = NodePath("magic vfx") -_magicWordNeeded = false [node name="Seeds" type="Node2D" parent="."] position = Vector2(0, 0.5) @@ -130,7 +129,6 @@ region_rect = Rect2(5416, 136, 647, 895) [node name="GrowingInteractionArea" parent="." instance=ExtResource("5_3j24b")] position = Vector2(0, 2.3) _useOutline = false -_useSprite = false [node name="CollisionShape3D" parent="GrowingInteractionArea/Area2D" index="0"] shape = SubResource("CircleShape2D_vjw4j") diff --git a/prefabs/farm/plants/beet_plant.tscn b/prefabs/farm/plants/beet_plant.tscn index 8f6dedc..035f1fb 100644 --- a/prefabs/farm/plants/beet_plant.tscn +++ b/prefabs/farm/plants/beet_plant.tscn @@ -12,7 +12,8 @@ radius = 300.0 resource_local_to_scene = true radius = 300.0 -[node name="Beet2" instance=ExtResource("1_2u3jr")] +[node name="Beet" instance=ExtResource("1_2u3jr")] +_prefabPath = "res://prefabs/farm/plants/beet_plant.tscn" [node name="Seed1" parent="Seeds" index="0"] texture = ExtResource("2_agmuy") @@ -47,6 +48,9 @@ shape = SubResource("CircleShape2D_hiixr") [node name="SpawnWithItem" parent="ReadyPlantInventoryItem" index="0"] _blueprint = ExtResource("3_agmuy") +[node name="PickupInteractionArea" parent="ReadyPlantInventoryItem" index="3"] +_active = false + [node name="CollisionShape3D" parent="ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"] shape = SubResource("CircleShape2D_ae08q") diff --git a/prefabs/farm/plants/tomato_plant.tscn b/prefabs/farm/plants/tomato_plant.tscn index 5df96ea..190d616 100644 --- a/prefabs/farm/plants/tomato_plant.tscn +++ b/prefabs/farm/plants/tomato_plant.tscn @@ -12,6 +12,7 @@ resource_local_to_scene = true radius = 300.0 [node name="TomatoPlant" instance=ExtResource("1_ooshk")] +_prefabPath = "res://prefabs/farm/plants/tomato_plant.tscn" [node name="Seed1" parent="Seeds" index="0"] texture = ExtResource("2_gdicx") diff --git a/prefabs/interactions/detection_cross.tscn b/prefabs/interactions/detection_cross.tscn index 57930bc..5814bea 100644 --- a/prefabs/interactions/detection_cross.tscn +++ b/prefabs/interactions/detection_cross.tscn @@ -6,7 +6,7 @@ [node name="DetectionCross" type="Node2D" node_paths=PackedStringArray("_detector")] script = ExtResource("1_va8tx") _detector = NodePath("detector") -_xOffset = 300.0 +_xOffset = 400.0 _yOffset = 300.0 [node name="detector" parent="." instance=ExtResource("2_8hh05")] diff --git a/prefabs/interactions/detector.tscn b/prefabs/interactions/detector.tscn index 2b4626e..967829b 100644 --- a/prefabs/interactions/detector.tscn +++ b/prefabs/interactions/detector.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://c3pd60biootsx" path="res://scripts/CSharp/Common/CharacterControls/Detector.cs" id="1_6pib0"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_qwv4c"] -size = Vector2(100, 200) +size = Vector2(100, 400) [node name="detector" type="Area2D"] collision_layer = 4 diff --git a/prefabs/interactions/generic_item_on_ground_2d.tscn b/prefabs/interactions/generic_item_on_ground_2d.tscn index 574dac0..17b25e2 100644 --- a/prefabs/interactions/generic_item_on_ground_2d.tscn +++ b/prefabs/interactions/generic_item_on_ground_2d.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://dpbbroif2tnil"] +[gd_scene load_steps=17 format=3 uid="uid://dpbbroif2tnil"] [ext_resource type="Script" uid="uid://btusf04xnywhm" path="res://scripts/CSharp/Common/Inventory/ItemOnGround2D.cs" id="1_tlhp6"] [ext_resource type="Script" uid="uid://c8suoi3i6kqai" path="res://scripts/CSharp/Common/Inventory/ItemOnGroundSpawnWith.cs" id="3_xu8me"] @@ -10,6 +10,8 @@ [ext_resource type="AudioStream" uid="uid://bqm6rchwtelxj" path="res://audio/sfx/UI/SFX_ItemPickUp_03.wav" id="8_kflfw"] [ext_resource type="AudioStream" uid="uid://brsufnpmig5fv" path="res://audio/sfx/UI/SFX_ItemPickUp_04.wav" id="9_dltn0"] [ext_resource type="Script" uid="uid://dx25g14a7xi4w" path="res://scripts/CSharp/Common/Audio/AudioPlayer.cs" id="10_clbey"] +[ext_resource type="Script" uid="uid://b5dotkx17gvxg" path="res://scripts/CSharp/Low Code/Events/EventRaiser.cs" id="11_kflfw"] +[ext_resource type="Resource" uid="uid://78t0o27g6aq6" path="res://resources/low code/interactables/event_PickedUpInteractable.tres" id="12_dltn0"] [sub_resource type="Theme" id="Theme_tlhp6"] default_font_size = 80 @@ -55,9 +57,9 @@ theme = SubResource("Theme_harr4") text = "thewe waf a pwoblem wiph picking up te item UWU" autowrap_mode = 3 -[node name="PickupInteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("4_xu8me")] +[node name="PickupInteractionArea" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("4_xu8me")] _outlineMaterial = ExtResource("4_harr4") -_spriteToOutline = NodePath("../Icon") +_spritesToOutline = [NodePath("../Icon")] [node name="CollisionShape3D" parent="PickupInteractionArea/Area2D" index="0"] shape = SubResource("CircleShape2D_tlhp6") @@ -74,6 +76,10 @@ bus = &"SFX" playback_type = 2 script = ExtResource("10_clbey") +[node name="PickUpEventRaiser" type="Node" parent="."] +script = ExtResource("11_kflfw") +_eventResources = Array[Object]([ExtResource("12_dltn0")]) + [connection signal="Interacted" from="PickupInteractionArea" to="." method="TryPickUp"] [connection signal="Interacted" from="PickupInteractionArea" to="SFX/PickUpSound" method="PlayOneShot"] diff --git a/project.godot b/project.godot index a9de2c5..759b354 100644 --- a/project.godot +++ b/project.godot @@ -32,6 +32,8 @@ InputService="*res://scripts/CSharp/Common/Services/InputService.cs" QuestManager="*res://prefabs/quests/quest_manager_autoload.tscn" Signal_Debugger="*res://addons/SignalVisualizer/Debugger/SignalDebugger.gd" FightWorldAutoload="*res://prefabs/fight/fight_world_autoload.tscn" +FieldService="*res://scripts/CSharp/Common/Farming/FieldService.cs" +SaveGameManager="*res://scripts/CSharp/Common/Savegame/SaveGameManager.cs" [dialogic] @@ -144,8 +146,11 @@ directories/tres_directory={ "default_bus_layout": "res://audio/default_bus_layout.tres", "default_stylebox": "res://addons/dialogic/Modules/DefaultLayoutParts/Layer_SpeakerPortraitTextbox/default_stylebox.tres", "default_vn_style": "res://addons/dialogic/Modules/DefaultLayoutParts/Style_VN_Default/default_vn_style.tres", +"event_PickedUpInteractable": "res://resources/low code/interactables/event_PickedUpInteractable.tres", "event_colorButtonClicked": "res://resources/low code/test/event_colorButtonClicked.tres", +"event_newPlantCreated": "res://resources/low code/farming/event_newPlantCreated.tres", "event_textLabelClicked": "res://resources/low code/test/event_textLabelClicked.tres", +"event_watering": "res://resources/low code/farming/event_watering.tres", "farming_equipment_glossary": "res://dialog/farming_equipment_glossary.tres", "hoe": "res://resources/items/hoe.tres", "inventory_interactable_outline": "res://art/materials/inventory_interactable_outline.tres", @@ -170,6 +175,8 @@ directories/tres_directory={ "unselected_stylebox": "res://addons/dialogic/Editor/Events/styles/unselected_stylebox.tres", "var_ColorTestValue": "res://resources/low code/test/var_ColorTestValue.tres", "var_Counter": "res://resources/low code/test/var_Counter.tres", +"var_sceneNameProvider": "res://resources/low code/farming/var_sceneNameProvider.tres", +"var_wateredFieldPosition": "res://resources/low code/farming/var_wateredFieldPosition.tres", "vesna_style": "res://addons/dialogic/vesna_style.tres", "vn_textbox_default_panel": "res://addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/vn_textbox_default_panel.tres", "vn_textbox_name_label_panel": "res://addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/vn_textbox_name_label_panel.tres", @@ -205,19 +212,14 @@ folder_colors={ "res://audio/": "yellow", "res://dialog/": "green", "res://fonts/": "green", -"res://logos/": "green", -"res://prefabs/": "teal", -"res://resources/": "teal", -"res://scenes/": "blue", -"res://scripts/": "purple", +"res://logos/": "blue", +"res://prefabs/": "purple", +"res://resources/": "purple", +"res://scenes/": "purple", +"res://scripts/": "pink", "res://shader/": "pink" } -[global_group] - -PlantGrowing="" -Pickup="" - [input] move_left={ diff --git a/resources/low code/farming/event_newPlantCreated.tres b/resources/low code/farming/event_newPlantCreated.tres new file mode 100644 index 0000000..754f2e2 --- /dev/null +++ b/resources/low code/farming/event_newPlantCreated.tres @@ -0,0 +1,7 @@ +[gd_resource type="Resource" script_class="EventResource" load_steps=2 format=3 uid="uid://b4hawvsc7cmkn"] + +[ext_resource type="Script" uid="uid://ci3t5mvnopntg" path="res://scripts/CSharp/Low Code/Events/EventResource.cs" id="1_o6pnj"] + +[resource] +script = ExtResource("1_o6pnj") +metadata/_custom_type_script = "uid://ci3t5mvnopntg" diff --git a/resources/low code/farming/event_watering.tres b/resources/low code/farming/event_watering.tres new file mode 100644 index 0000000..9179160 --- /dev/null +++ b/resources/low code/farming/event_watering.tres @@ -0,0 +1,7 @@ +[gd_resource type="Resource" script_class="EventResource" load_steps=2 format=3 uid="uid://cmqapbvv0hev2"] + +[ext_resource type="Script" uid="uid://ci3t5mvnopntg" path="res://scripts/CSharp/Low Code/Events/EventResource.cs" id="1_qophu"] + +[resource] +script = ExtResource("1_qophu") +metadata/_custom_type_script = "uid://ci3t5mvnopntg" diff --git a/resources/low code/farming/var_sceneNameProvider.tres b/resources/low code/farming/var_sceneNameProvider.tres new file mode 100644 index 0000000..0215ee7 --- /dev/null +++ b/resources/low code/farming/var_sceneNameProvider.tres @@ -0,0 +1,8 @@ +[gd_resource type="Resource" script_class="VariableResource" load_steps=2 format=3 uid="uid://tt3d166mntmi"] + +[ext_resource type="Script" uid="uid://dtvx2cakx0bey" path="res://scripts/CSharp/Low Code/Variables/VariableResource.cs" id="1_m5pb0"] + +[resource] +script = ExtResource("1_m5pb0") +Payload = "farmOutside" +metadata/_custom_type_script = "uid://dtvx2cakx0bey" diff --git a/resources/low code/farming/var_wateredFieldPosition.tres b/resources/low code/farming/var_wateredFieldPosition.tres new file mode 100644 index 0000000..81b720a --- /dev/null +++ b/resources/low code/farming/var_wateredFieldPosition.tres @@ -0,0 +1,8 @@ +[gd_resource type="Resource" script_class="VariableResource" load_steps=2 format=3 uid="uid://svfgwtb3xosj"] + +[ext_resource type="Script" uid="uid://dtvx2cakx0bey" path="res://scripts/CSharp/Low Code/Variables/VariableResource.cs" id="1_qoiop"] + +[resource] +script = ExtResource("1_qoiop") +Payload = Vector2(0, 0) +metadata/_custom_type_script = "uid://dtvx2cakx0bey" diff --git a/resources/low code/interactables/event_PickedUpInteractable.tres b/resources/low code/interactables/event_PickedUpInteractable.tres new file mode 100644 index 0000000..9865d84 --- /dev/null +++ b/resources/low code/interactables/event_PickedUpInteractable.tres @@ -0,0 +1,7 @@ +[gd_resource type="Resource" script_class="EventResource" load_steps=2 format=3 uid="uid://78t0o27g6aq6"] + +[ext_resource type="Script" uid="uid://ci3t5mvnopntg" path="res://scripts/CSharp/Low Code/Events/EventResource.cs" id="1_acx84"] + +[resource] +script = ExtResource("1_acx84") +metadata/_custom_type_script = "uid://ci3t5mvnopntg" diff --git a/scenes/Babushka_scene_farm_outside_2d.tscn b/scenes/Babushka_scene_farm_outside_2d.tscn index c9a605c..fbf8c7e 100644 --- a/scenes/Babushka_scene_farm_outside_2d.tscn +++ b/scenes/Babushka_scene_farm_outside_2d.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=117 format=3 uid="uid://gigb28qk8t12"] +[gd_scene load_steps=116 format=3 uid="uid://gigb28qk8t12"] [ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Player2D.tscn" id="1_7wfwe"] [ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"] @@ -28,7 +28,6 @@ [ext_resource type="Texture2D" uid="uid://dg7rlugnq0t45" path="res://art/farm/farming/farmobjekte/brünnen.png" id="21_ualyd"] [ext_resource type="Texture2D" uid="uid://bcw6oeovkmiup" path="res://art/nature/baum märz 2025/sonnenblumeseamless.png" id="23_d77e7"] [ext_resource type="PackedScene" uid="uid://dfvgp1my5rydh" path="res://prefabs/characters/Yeli.tscn" id="24_wtdui"] -[ext_resource type="Script" uid="uid://dhxtdhfqx3bte" path="res://scripts/CSharp/Common/Farming/FieldService2D.cs" id="25_0qu0h"] [ext_resource type="PackedScene" uid="uid://dpbbroif2tnil" path="res://prefabs/interactions/generic_item_on_ground_2d.tscn" id="25_hukxv"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="27_klb81"] [ext_resource type="Resource" uid="uid://dlcmqfjvgphqu" path="res://resources/items/rake.tres" id="28_6b2nr"] @@ -75,8 +74,11 @@ [ext_resource type="Resource" uid="uid://5t8g0firdif0" path="res://resources/quests/demo/5_talk_yeli_3.tres" id="69_l4wxt"] [ext_resource type="Script" uid="uid://bhbldab74vmhy" path="res://scripts/CSharp/Common/QuestBehaviour/DetectFieldWork.cs" id="74_fv1t2"] [ext_resource type="Resource" uid="uid://h05jgxqtq37m" path="res://resources/quests/demo/6_till_and_water.tres" id="75_l7ekk"] +[ext_resource type="Script" uid="uid://dfpyjxivcuidr" path="res://scripts/CSharp/Low Code/Variables/VariableSetter.cs" id="76_l7ekk"] [ext_resource type="Resource" uid="uid://byjqeukpibkvi" path="res://resources/quests/demo/7_talk_yeli_inside_1.tres" id="76_xcwle"] [ext_resource type="Script" uid="uid://dih1b0opgc3f7" path="res://scripts/GdScript/dialogic_start_specific.gd" id="77_l7ekk"] +[ext_resource type="Resource" uid="uid://tt3d166mntmi" path="res://resources/low code/farming/var_sceneNameProvider.tres" id="77_xcwle"] +[ext_resource type="PackedScene" uid="uid://b1d2e7ely6hyw" path="res://prefabs/farm/base_field.tscn" id="78_xcwle"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_wtdui"] shader = ExtResource("13_7p0hq") @@ -211,13 +213,6 @@ shader_parameter/tiling_scale = Vector2(1, 20) shader = ExtResource("13_kt1wx") shader_parameter/tiling_scale = Vector2(1, 25) -[sub_resource type="RectangleShape2D" id="RectangleShape2D_2nee2"] -size = Vector2(5782, 1176) - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_p6n74"] -resource_local_to_scene = true -size = Vector2(7150, 1192) - [sub_resource type="ShaderMaterial" id="ShaderMaterial_lwk6t"] shader = ExtResource("13_7p0hq") shader_parameter/hue_shift = 0.0 @@ -1036,16 +1031,16 @@ position = Vector2(6403, 3362) _timelinesToPlay = PackedStringArray("yeli_quest_select") _retriggerSameTimeline = true -[node name="Vesna" parent="YSorted" node_paths=PackedStringArray("_fieldParent") instance=ExtResource("1_7wfwe")] +[node name="Vesna" parent="YSorted" instance=ExtResource("1_7wfwe")] z_index = 1 position = Vector2(9322, 2018) -_fieldParent = NodePath("../Farm visuals/FieldParent") _hoe = ExtResource("28_6b2nr") -[node name="FarmingControls" parent="YSorted/Vesna" index="1" node_paths=PackedStringArray("_camera")] +[node name="FarmingControls" parent="YSorted/Vesna" index="1" node_paths=PackedStringArray("_camera", "_fieldParent")] _camera = NodePath("../../../Camera2D") +_fieldParent = NodePath("../../FieldParent") -[node name="Brünnen" type="Sprite2D" parent="YSorted" node_paths=PackedStringArray("_interactionArea")] +[node name="Well" type="Sprite2D" parent="YSorted" node_paths=PackedStringArray("_interactionArea")] z_index = 1 y_sort_enabled = true material = SubResource("ShaderMaterial_2vojv") @@ -1057,19 +1052,18 @@ region_rect = Rect2(0, 0, 1504, 1686) script = ExtResource("32_lbnqo") _interactionArea = NodePath("InteractionArea") -[node name="StaticBody2D" type="StaticBody2D" parent="YSorted/Brünnen"] +[node name="StaticBody2D" type="StaticBody2D" parent="YSorted/Well"] collision_mask = 4 -[node name="CollisionShape2D" type="CollisionShape2D" parent="YSorted/Brünnen/StaticBody2D"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="YSorted/Well/StaticBody2D"] position = Vector2(145.5, -224) shape = SubResource("RectangleShape2D_0sfl7") -[node name="InteractionArea" parent="YSorted/Brünnen" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("27_klb81")] -_active = false -_spriteToOutline = NodePath("..") +[node name="InteractionArea" parent="YSorted/Well" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("27_klb81")] +_spritesToOutline = [NodePath("..")] _id = 1 -[node name="CollisionShape3D" parent="YSorted/Brünnen/InteractionArea/Area2D" index="0"] +[node name="CollisionShape3D" parent="YSorted/Well/InteractionArea/Area2D" index="0"] position = Vector2(146, -130) shape = SubResource("CircleShape2D_p6n74") @@ -1108,10 +1102,6 @@ shape = SubResource("CircleShape2D_tm0yg") [node name="Icon" parent="YSorted/SeedPickup" index="4"] scale = Vector2(1, 1) -[node name="Sprite2D" type="Sprite2D" parent="YSorted/SeedPickup"] -texture = ExtResource("36_l7ekk") -region_enabled = true - [node name="SeedPickup2" parent="YSorted" instance=ExtResource("25_hukxv")] position = Vector2(10705, 2257) _finiteSupply = 3 @@ -1125,6 +1115,117 @@ shape = SubResource("CircleShape2D_tm0yg") [node name="Icon" parent="YSorted/SeedPickup2" index="4"] scale = Vector2(1, 1) +[node name="FieldParent" type="Node2D" parent="YSorted"] +position = Vector2(0, -200) + +[node name="right" type="Node2D" parent="YSorted/FieldParent"] + +[node name="BaseField" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(8807, 3061) + +[node name="BaseField2" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(9335, 3562) +Payload = 1 + +[node name="BaseField3" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(9854, 3071) +Payload = 2 + +[node name="BaseField4" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(10361, 3536) +Payload = 3 + +[node name="BaseField5" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(10948, 3025) +Payload = 4 + +[node name="BaseField6" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(11296, 3607) +Payload = 5 + +[node name="BaseField7" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(11869, 3026) +Payload = 6 + +[node name="BaseField8" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(12353, 3554) +Payload = 7 + +[node name="BaseField9" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(12828, 2999) +Payload = 8 + +[node name="BaseField10" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(13285, 3536) +Payload = 9 + +[node name="BaseField11" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(13733, 2990) +Payload = 10 + +[node name="BaseField12" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(14261, 3474) +Payload = 11 + +[node name="BaseField13" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(14753, 2982) +Payload = 12 + +[node name="BaseField14" parent="YSorted/FieldParent/right" instance=ExtResource("78_xcwle")] +position = Vector2(15201, 3519) +Payload = 13 + +[node name="left" type="Node2D" parent="YSorted/FieldParent"] +position = Vector2(-8661, -143) + +[node name="BaseField" parent="YSorted/FieldParent/left" instance=ExtResource("78_xcwle")] +position = Vector2(8807, 3061) +Payload = 14 + +[node name="BaseField2" parent="YSorted/FieldParent/left" instance=ExtResource("78_xcwle")] +position = Vector2(9227, 3562) +Payload = 15 + +[node name="BaseField3" parent="YSorted/FieldParent/left" instance=ExtResource("78_xcwle")] +position = Vector2(9756, 3111) +Payload = 16 + +[node name="BaseField4" parent="YSorted/FieldParent/left" instance=ExtResource("78_xcwle")] +position = Vector2(10322, 3536) +Payload = 17 + +[node name="BaseField5" parent="YSorted/FieldParent/left" instance=ExtResource("78_xcwle")] +position = Vector2(10810, 3055) +Payload = 18 + +[node name="BaseField6" parent="YSorted/FieldParent/left" instance=ExtResource("78_xcwle")] +position = Vector2(11266, 3607) +Payload = 19 + +[node name="BaseField7" parent="YSorted/FieldParent/left" instance=ExtResource("78_xcwle")] +position = Vector2(11741, 3026) +Payload = 20 + +[node name="BaseField8" parent="YSorted/FieldParent/left" instance=ExtResource("78_xcwle")] +position = Vector2(12255, 3593) +Payload = 21 + +[node name="BaseField9" parent="YSorted/FieldParent/left" instance=ExtResource("78_xcwle")] +position = Vector2(12690, 3019) +Payload = 22 + +[node name="BaseField10" parent="YSorted/FieldParent/left" instance=ExtResource("78_xcwle")] +position = Vector2(13216, 3556) +Payload = 23 + +[node name="BaseField11" parent="YSorted/FieldParent/left" instance=ExtResource("78_xcwle")] +position = Vector2(13684, 3000) +Payload = 24 + +[node name="BaseField12" parent="YSorted/FieldParent/left" instance=ExtResource("78_xcwle")] +position = Vector2(14143, 3523) +Payload = 25 + [node name="Farm visuals" type="Node2D" parent="YSorted"] position = Vector2(-60, 122) @@ -1146,10 +1247,10 @@ collision_mask = 6 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")] +[node name="EnterHouseInteraction" parent="YSorted/Farm visuals/Static" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("27_klb81")] position = Vector2(5834, 2354) scale = Vector2(2.425, 2.425) -_spriteToOutline = NodePath("DoorSprite") +_spritesToOutline = [NodePath("DoorSprite")] _id = 0 [node name="DoorSprite" type="Sprite2D" parent="YSorted/Farm visuals/Static/EnterHouseInteraction"] @@ -1856,7 +1957,7 @@ region_rect = Rect2(332, 194, 179, 154) [node name="grass3" type="Sprite2D" parent="YSorted/Farm visuals/Static/greenery/grass"] modulate = Color(0.954868, 0.882599, 0.798501, 1) z_index = -5 -position = Vector2(18189, 1960) +position = Vector2(18165, 1966) scale = Vector2(5.77602, 3.87779) texture = ExtResource("42_loeum") region_enabled = true @@ -2101,27 +2202,6 @@ rotation = 1.5708 scale = Vector2(0.1, 10.8) texture = ExtResource("21_if5vh") -[node name="FieldParent" type="Node2D" parent="YSorted/Farm visuals" node_paths=PackedStringArray("fields", "_allowedArea")] -position = Vector2(53, 20) -scale = Vector2(1, 0.993819) -script = ExtResource("25_0qu0h") -fields = {} -_allowedArea = NodePath("Area2D") -metadata/_custom_type_script = "uid://dhxtdhfqx3bte" - -[node name="Area2D" type="Area2D" parent="YSorted/Farm visuals/FieldParent"] -position = Vector2(-48, -16) -collision_mask = 5 -collision_priority = 10.0 - -[node name="CollisionShape2D" type="CollisionShape2D" parent="YSorted/Farm visuals/FieldParent/Area2D"] -position = Vector2(2896, 2949) -shape = SubResource("RectangleShape2D_2nee2") - -[node name="CollisionShape2D2" type="CollisionShape2D" parent="YSorted/Farm visuals/FieldParent/Area2D"] -position = Vector2(11914, 2960) -shape = SubResource("RectangleShape2D_p6n74") - [node name="Blocker" type="Node2D" parent="YSorted"] [node name="Fence Door2" type="Sprite2D" parent="YSorted/Blocker"] @@ -2139,9 +2219,9 @@ 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")] +[node name="InteractionArea" parent="YSorted/Blocker" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("27_klb81")] position = Vector2(11234, 1850) -_spriteToOutline = NodePath("Fence Door") +_spritesToOutline = [NodePath("Fence Door")] _id = 1 [node name="CollisionShape3D" parent="YSorted/Blocker/InteractionArea/Area2D" index="0"] @@ -2163,6 +2243,7 @@ position = Vector2(-113.561, 193.035) shape = SubResource("RectangleShape2D_2vojv") [node name="ducks" type="Node2D" parent="YSorted"] +visible = false z_index = 1 y_sort_enabled = true script = ExtResource("49_uxa2m") @@ -2239,6 +2320,7 @@ position = Vector2(-4659, 2897) position = Vector2(-5016, 3361) [node name="trash" type="Node2D" parent="YSorted"] +visible = false z_index = 1 y_sort_enabled = true @@ -2422,16 +2504,18 @@ _toNextQuest = ExtResource("76_xcwle") script = ExtResource("77_l7ekk") timeline = "quest2_tomatoes_end" +[node name="SceneNameSetter" type="Node" parent="."] +script = ExtResource("76_l7ekk") +_variableResource = ExtResource("77_xcwle") +_payloadToSet = "farmOutside" + [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="InteractedTool" from="YSorted/Well/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="SuccessfulPickUp" from="YSorted/SeedPickup" to="YSorted/Vesna" method="HandlePickUp"] [connection signal="SuccessfulPickUp" from="YSorted/SeedPickup2" to="YSorted/Vesna" method="HandlePickUp"] [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"] @@ -2444,9 +2528,10 @@ timeline = "quest2_tomatoes_end" [connection signal="finished" from="Audio/Background Music Ramp up" to="Audio/Background Music loop" method="PlayFromOffset"] [connection signal="ready" from="SpecialQuestTrigger/QuestInstantStart" to="SpecialQuestTrigger/QuestInstantStart/QuestTrigger" method="Trigger"] [connection signal="OnFulfilled" from="SpecialQuestTrigger/FieldWorkTrigger" to="SpecialQuestTrigger/FieldWorkTrigger/StartDialog" method="open"] +[connection signal="tree_entered" from="SceneNameSetter" to="SceneNameSetter" method="Set"] [editable path="YSorted/Vesna"] -[editable path="YSorted/Brünnen/InteractionArea"] +[editable path="YSorted/Well/InteractionArea"] [editable path="YSorted/CanGenericPickup"] [editable path="YSorted/CanGenericPickup/PickupInteractionArea"] [editable path="YSorted/RakeGenericPickup"] diff --git a/scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn b/scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn index 9cd1c59..bc363ac 100644 --- a/scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn +++ b/scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn @@ -2248,7 +2248,6 @@ playback_type = 2 script = ExtResource("59_0knno") [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"] diff --git a/scenes/Babushka_scene_forest_fight_1_2d.tscn b/scenes/Babushka_scene_forest_fight_1_2d.tscn index 860d079..5b218ae 100644 --- a/scenes/Babushka_scene_forest_fight_1_2d.tscn +++ b/scenes/Babushka_scene_forest_fight_1_2d.tscn @@ -2202,7 +2202,6 @@ makeActive = true [connection signal="FightStarted" from="Fight2/FightBaseScene" to="YSorted/Vesna" method="DisableMovement"] [connection signal="timelineEnded" from="YSorted/Chuga/Dialogic starter/DialogicToggle" to="YSorted/Chuga" method="set_position" binds= [Vector2(14579, 2951)]] [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="finished" from="Audio/Background Music Ramp up" to="Audio/Background Music loop" method="PlayFromOffset"] [connection signal="ready" from="SpecialQuestNodes/InstantStartQuest" to="SpecialQuestNodes/InstantStartQuest" method="Trigger"] diff --git a/scenes/Babushka_scene_indoor_common_room.tscn b/scenes/Babushka_scene_indoor_common_room.tscn index 5014960..a2023a6 100644 --- a/scenes/Babushka_scene_indoor_common_room.tscn +++ b/scenes/Babushka_scene_indoor_common_room.tscn @@ -309,10 +309,10 @@ texture = ExtResource("6_blyw3") region_enabled = true region_rect = Rect2(3161, 313, 679, 1050) -[node name="OutsideDoor" parent="BackWall/Room01DorrR" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("11_gpagp")] +[node name="OutsideDoor" parent="BackWall/Room01DorrR" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("11_gpagp")] position = Vector2(-7, 248) scale = Vector2(1.5, 1.5) -_spriteToOutline = NodePath("..") +_spritesToOutline = [NodePath("..")] _id = 1 [node name="Room01DoorL" type="Sprite2D" parent="BackWall"] @@ -322,9 +322,9 @@ texture = ExtResource("7_yd2gv") region_enabled = true region_rect = Rect2(0, 0, 3840, 2160) -[node name="VesnasRoomDoor" parent="BackWall/Room01DoorL" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("11_gpagp")] +[node name="VesnasRoomDoor" parent="BackWall/Room01DoorL" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("11_gpagp")] position = Vector2(-1559, -16) -_spriteToOutline = NodePath("..") +_spritesToOutline = [NodePath("..")] _id = 0 [node name="CollisionShape3D" parent="BackWall/Room01DoorL/VesnasRoomDoor/Area2D" index="0"] @@ -358,9 +358,9 @@ texture = ExtResource("10_xcryd") region_enabled = true region_rect = Rect2(2360, 864, 356, 251) -[node name="InteractionArea" parent="BackWall/Room01PechkaDoor" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("11_gpagp")] +[node name="InteractionArea" parent="BackWall/Room01PechkaDoor" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("11_gpagp")] position = Vector2(0, -3) -_spriteToOutline = NodePath("..") +_spritesToOutline = [NodePath("..")] [node name="CollisionShape3D" parent="BackWall/Room01PechkaDoor/InteractionArea/Area2D" index="0"] shape = SubResource("CircleShape2D_gpagp") @@ -407,10 +407,10 @@ stream = SubResource("AudioStreamRandomizer_b6vf7") bus = &"SFX" script = ExtResource("22_tggq2") -[node name="InteractionArea" parent="BackWall/Katze" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("11_gpagp")] +[node name="InteractionArea" parent="BackWall/Katze" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("11_gpagp")] position = Vector2(-6.5, -44) scale = Vector2(0.5, 0.5) -_spriteToOutline = NodePath("..") +_spritesToOutline = [NodePath("..")] [node name="Room assets" type="Node" parent="BackWall"] diff --git a/scenes/Babushka_scene_outside_beets.tscn b/scenes/Babushka_scene_outside_beets.tscn index bbd17ac..a259778 100644 --- a/scenes/Babushka_scene_outside_beets.tscn +++ b/scenes/Babushka_scene_outside_beets.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=85 format=3 uid="uid://b3ibx4resa1f3"] +[gd_scene load_steps=96 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"] @@ -42,14 +42,15 @@ [ext_resource type="PackedScene" uid="uid://dpbbroif2tnil" path="res://prefabs/interactions/generic_item_on_ground_2d.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"] [ext_resource type="Texture2D" uid="uid://blb3agipyxnal" path="res://art/farm/farming/farmobjekte/zaun/fence_door.png" id="47_xfjh2"] [ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="52_gwhnv"] [ext_resource type="AudioStream" uid="uid://dku1rq5cocisg" path="res://audio/Music/Farming_90BPM_69Bars.wav" id="53_2tfpr"] [ext_resource type="Script" uid="uid://clxb3n668oud3" path="res://scripts/CSharp/Common/Audio/AudioDebugger.cs" id="54_pn8sy"] [ext_resource type="AudioStream" uid="uid://cfqg50am0swb7" path="res://audio/Music/Farming_90BPM_69Bars_Loop.wav" id="55_aq24k"] +[ext_resource type="Script" uid="uid://dfpyjxivcuidr" path="res://scripts/CSharp/Low Code/Variables/VariableSetter.cs" id="56_34r5t"] [ext_resource type="AudioStream" uid="uid://vcftvrpi6c7k" path="res://audio/sfx/Farming/SFX_Harke_03_Solo.wav" id="56_vojpc"] [ext_resource type="AudioStream" uid="uid://bxh5m04vdo0sr" path="res://audio/sfx/Farming/SFX_Harke_04_Solo.wav" id="57_euap5"] +[ext_resource type="Resource" uid="uid://tt3d166mntmi" path="res://resources/low code/farming/var_sceneNameProvider.tres" id="57_hpgl7"] [ext_resource type="Script" uid="uid://cfnrd5k1k0gxw" path="res://scripts/CSharp/Common/AudioPlayer2D.cs" id="58_m3hs4"] [ext_resource type="AudioStream" uid="uid://dapsknn486aee" path="res://audio/sfx/Farming/SFX_WateringPlants_01.wav" id="59_km2vg"] [ext_resource type="AudioStream" uid="uid://dnyne8wov50so" path="res://audio/sfx/Farming/SFX_WateringPlants_02.wav" id="60_qi2gu"] @@ -169,6 +170,42 @@ 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 = 325.2599 + +[sub_resource type="CircleShape2D" id="CircleShape2D_njxly"] +resource_local_to_scene = true +radius = 325.2599 + +[sub_resource type="CircleShape2D" id="CircleShape2D_54ty3"] +resource_local_to_scene = true +radius = 325.2599 + +[sub_resource type="CircleShape2D" id="CircleShape2D_gbxtf"] +resource_local_to_scene = true +radius = 325.2599 + +[sub_resource type="CircleShape2D" id="CircleShape2D_6krrk"] +resource_local_to_scene = true +radius = 325.2599 + +[sub_resource type="CircleShape2D" id="CircleShape2D_4ktoi"] +resource_local_to_scene = true +radius = 325.2599 + +[sub_resource type="CircleShape2D" id="CircleShape2D_aaup4"] +resource_local_to_scene = true +radius = 325.2599 + +[sub_resource type="CircleShape2D" id="CircleShape2D_v10dc"] +resource_local_to_scene = true +radius = 325.2599 + +[sub_resource type="CircleShape2D" id="CircleShape2D_4pibb"] +resource_local_to_scene = true +radius = 325.2599 + [sub_resource type="CircleShape2D" id="CircleShape2D_dr6bm"] resource_local_to_scene = true radius = 335.72162 @@ -184,6 +221,10 @@ shader_parameter/contrast_mult = 1.0 [sub_resource type="RectangleShape2D" id="RectangleShape2D_ycj14"] size = Vector2(707.116, 604.111) +[sub_resource type="CircleShape2D" id="CircleShape2D_hpgl7"] +resource_local_to_scene = true +radius = 294.02722 + [sub_resource type="AudioStreamPlaylist" id="AudioStreamPlaylist_ceriq"] loop = false stream_count = 1 @@ -205,7 +246,7 @@ stream_0/stream = ExtResource("61_wy1mx") stream_1/stream = ExtResource("62_kmjnt") stream_2/stream = ExtResource("63_td2xu") -[node name="BabushkaSceneFarmOutside2d" type="Node2D"] +[node name="BabushkaSceneBeets" type="Node2D"] script = ExtResource("1_6krrk") _sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_farm_outside_2d.tscn") @@ -918,10 +959,9 @@ shape = SubResource("RectangleShape2D_0qu0h") z_index = 1 y_sort_enabled = true -[node name="Vesna" parent="YSorted" node_paths=PackedStringArray("_fieldParent") instance=ExtResource("27_qtaxr")] +[node name="Vesna" parent="YSorted" instance=ExtResource("27_qtaxr")] z_index = 1 position = Vector2(2693, 1876) -_fieldParent = NodePath("../Farm visuals/FieldParent") _hoe = ExtResource("28_le48k") [node name="Animated Sprites" parent="YSorted/Vesna/CharacterBody2D/visuals" index="0"] @@ -956,8 +996,8 @@ collision_mask = 4 position = Vector2(145.5, -224) shape = SubResource("RectangleShape2D_0sfl7") -[node name="InteractionArea" parent="YSorted/Brünnen" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("31_xcb8u")] -_spriteToOutline = NodePath("..") +[node name="InteractionArea" parent="YSorted/Brünnen" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("31_xcb8u")] +_spritesToOutline = [NodePath("..")] _id = 1 [node name="CollisionShape3D" parent="YSorted/Brünnen/InteractionArea/Area2D" index="0"] @@ -1702,117 +1742,181 @@ rotation = 1.5708 scale = Vector2(0.1, 8.7) texture = ExtResource("26_bwvai") -[node name="FieldParent" type="Node2D" parent="YSorted/Farm visuals" node_paths=PackedStringArray("fields")] +[node name="FieldParent" type="Node2D" parent="YSorted/Farm visuals"] position = Vector2(53, 20) scale = Vector2(1, 0.993819) -script = ExtResource("46_xkmgh") -fields = {} -metadata/_custom_type_script = "uid://dhxtdhfqx3bte" [node name="BaseField" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] position = Vector2(651, 2630.26) scale = Vector2(1, 1.00622) +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField" index="1"] +visible = true + [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] _state = 2 _field = NodePath("../..") +[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField" index="7"] +visible = false + +[node name="CollisionShape3D" parent="YSorted/Farm visuals/FieldParent/BaseField/FieldActivator/InteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_qavgq") + [node name="BaseField2" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] position = Vector2(1226, 3098.15) scale = Vector2(1, 1.00622) +Payload = 1 -[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField2" index="0"] -FieldState = 3 +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField2" index="1"] +visible = true [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField2/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] -_state = 1 +_state = 2 _field = NodePath("../..") +[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField2" index="7"] +visible = false + +[node name="CollisionShape3D" parent="YSorted/Farm visuals/FieldParent/BaseField2/FieldActivator/InteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_njxly") + [node name="BaseField3" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] position = Vector2(1782, 2606.11) scale = Vector2(1, 1.00622) +Payload = 2 -[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField3" index="0"] -FieldState = 3 +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField3" index="1"] +visible = true [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField3/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] _state = 2 _field = NodePath("../..") +[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField3" index="7"] +visible = false + +[node name="CollisionShape3D" parent="YSorted/Farm visuals/FieldParent/BaseField3/FieldActivator/InteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_54ty3") + [node name="BaseField4" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] position = Vector2(2559, 2624.22) scale = Vector2(1, 1.00622) +Payload = 3 -[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField4" index="0"] +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField4" index="1"] +visible = true FieldState = 3 [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField4/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] _state = 2 _field = NodePath("../..") +[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField4" index="7"] +visible = false + +[node name="CollisionShape3D" parent="YSorted/Farm visuals/FieldParent/BaseField4/FieldActivator/InteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_gbxtf") + [node name="BaseField5" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] position = Vector2(3305, 2624.22) scale = Vector2(1, 1.00622) +Payload = 4 -[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField5" index="0"] +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField5" index="1"] +visible = true FieldState = 3 [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField5/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] _state = 2 _field = NodePath("../..") +[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField5" index="7"] +visible = false + +[node name="CollisionShape3D" parent="YSorted/Farm visuals/FieldParent/BaseField5/FieldActivator/InteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_6krrk") + [node name="BaseField6" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] position = Vector2(4033, 2618.18) scale = Vector2(1, 1.00622) +Payload = 5 -[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField6" index="0"] +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField6" index="1"] +visible = true FieldState = 3 [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField6/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] _state = 1 _field = NodePath("../..") +[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField6" index="7"] +visible = false + +[node name="CollisionShape3D" parent="YSorted/Farm visuals/FieldParent/BaseField6/FieldActivator/InteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_4ktoi") + [node name="BaseField7" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] position = Vector2(4755, 2630.26) scale = Vector2(1, 1.00622) +Payload = 6 -[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField7" index="0"] +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField7" index="1"] +visible = true FieldState = 3 [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField7/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] _state = 2 _field = NodePath("../..") +[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField7" index="7"] +visible = false + +[node name="CollisionShape3D" parent="YSorted/Farm visuals/FieldParent/BaseField7/FieldActivator/InteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_aaup4") + [node name="BaseField8" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] position = Vector2(4418, 3226.95) scale = Vector2(1, 1.00622) +Payload = 7 -[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField8" index="0"] +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField8" index="1"] +visible = true FieldState = 3 [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField8/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] _state = 2 _field = NodePath("../..") +[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField8" index="7"] +visible = false + +[node name="CollisionShape3D" parent="YSorted/Farm visuals/FieldParent/BaseField8/FieldActivator/InteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_v10dc") + [node name="BaseField9" parent="YSorted/Farm visuals/FieldParent" instance=ExtResource("40_efblm")] position = Vector2(5317, 3208.83) scale = Vector2(1, 1.00622) +Payload = 8 -[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField9" index="0"] -FieldState = 3 +[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField9" index="1"] +visible = true -[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField9/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] -_state = 1 -_field = NodePath("../..") +[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField9" index="7"] +visible = false + +[node name="CollisionShape3D" parent="YSorted/Farm visuals/FieldParent/BaseField9/FieldActivator/InteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_4pibb") [node name="Blocker" type="Node2D" parent="YSorted"] -[node name="BackToFarm" parent="YSorted/Blocker" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("31_xcb8u")] +[node name="BackToFarm" parent="YSorted/Blocker" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("31_xcb8u")] position = Vector2(3774, 2025) -_spriteToOutline = NodePath("Fence Door2") +_spritesToOutline = [NodePath("Fence Door2")] _id = 0 [node name="CollisionShape3D" parent="YSorted/Blocker/BackToFarm/Area2D" index="0"] +position = Vector2(-37, -208) shape = SubResource("CircleShape2D_dr6bm") [node name="Fence Door2" type="Sprite2D" parent="YSorted/Blocker/BackToFarm"] @@ -1848,6 +1952,18 @@ position = Vector2(14423, 5123) scale = Vector2(1.89667, 1) texture = ExtResource("23_s4721") +[node name="RakeGenericPickup" parent="YSorted" instance=ExtResource("43_dr6bm")] +position = Vector2(6401, 2602) + +[node name="SpawnWithItem" parent="YSorted/RakeGenericPickup" index="0"] +_blueprint = ExtResource("28_le48k") + +[node name="PickupInteractionArea" parent="YSorted/RakeGenericPickup" index="3"] +_id = 0 + +[node name="CollisionShape3D" parent="YSorted/RakeGenericPickup/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_hpgl7") + [node name="CanvasLayer" parent="." instance=ExtResource("52_gwhnv")] [node name="Inventory" parent="CanvasLayer" index="1"] @@ -1910,25 +2026,40 @@ max_distance = 20000000.0 playback_type = 2 script = ExtResource("58_m3hs4") +[node name="SceneNameSetter" type="Node" parent="."] +script = ExtResource("56_34r5t") +_variableResource = ExtResource("57_hpgl7") +_payloadToSet = "beetRootScene" + [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="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"] +[connection signal="tree_entered" from="SceneNameSetter" to="SceneNameSetter" method="Set"] [editable path="YSorted/Vesna"] [editable path="YSorted/Vesna/GenericItemOnGround"] [editable path="YSorted/Vesna/GenericItemOnGround/PickupInteractionArea"] [editable path="YSorted/Brünnen/InteractionArea"] [editable path="YSorted/Farm visuals/FieldParent/BaseField"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField/FieldActivator/InteractionArea"] [editable path="YSorted/Farm visuals/FieldParent/BaseField2"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField2/FieldActivator/InteractionArea"] [editable path="YSorted/Farm visuals/FieldParent/BaseField3"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField3/FieldActivator/InteractionArea"] [editable path="YSorted/Farm visuals/FieldParent/BaseField4"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField4/FieldActivator/InteractionArea"] [editable path="YSorted/Farm visuals/FieldParent/BaseField5"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField5/FieldActivator/InteractionArea"] [editable path="YSorted/Farm visuals/FieldParent/BaseField6"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField6/FieldActivator/InteractionArea"] [editable path="YSorted/Farm visuals/FieldParent/BaseField7"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField7/FieldActivator/InteractionArea"] [editable path="YSorted/Farm visuals/FieldParent/BaseField8"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField8/FieldActivator/InteractionArea"] [editable path="YSorted/Farm visuals/FieldParent/BaseField9"] +[editable path="YSorted/Farm visuals/FieldParent/BaseField9/FieldActivator/InteractionArea"] [editable path="YSorted/Blocker/BackToFarm"] +[editable path="YSorted/RakeGenericPickup"] +[editable path="YSorted/RakeGenericPickup/PickupInteractionArea"] [editable path="CanvasLayer"] diff --git a/scenes/Babushka_scene_startMenu.tscn b/scenes/Babushka_scene_startMenu.tscn index f4ea948..262a257 100644 --- a/scenes/Babushka_scene_startMenu.tscn +++ b/scenes/Babushka_scene_startMenu.tscn @@ -6,7 +6,7 @@ [node name="BabushkaSceneStartMenu" type="Node2D"] script = ExtResource("1_fj2fh") -_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_disclaimer.tscn") +_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_farm_outside_2d.tscn") [node name="CanvasLayer" type="CanvasLayer" parent="."] diff --git a/scripts/CSharp/Common/Animation/VesnaAnimations.cs b/scripts/CSharp/Common/Animation/VesnaAnimations.cs index 797490c..1881d2d 100644 --- a/scripts/CSharp/Common/Animation/VesnaAnimations.cs +++ b/scripts/CSharp/Common/Animation/VesnaAnimations.cs @@ -8,7 +8,6 @@ namespace Babushka.scripts.CSharp.Common.Animation; public partial class VesnaAnimations : Node { [Export] private AnimatedSprite2D _sprite; - [Export] private CpuParticles2D _wateringParticles; private bool anyActionPressed; private string _toolString; @@ -144,7 +143,6 @@ public partial class VesnaAnimations : Node _sprite.Animation = "diagonal wateringcan"; _sprite.Play(); InputService.Instance.InputEnabled = false; - _wateringParticles.Emitting = true; Task.Run(DelayedInputHandlerReset); } } @@ -152,7 +150,6 @@ public partial class VesnaAnimations : Node private async Task DelayedInputHandlerReset() { await Task.Delay(1000); - _wateringParticles.Emitting = false; InputService.Instance.InputEnabled = true; } diff --git a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs index e7f1380..9a421cd 100644 --- a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs +++ b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs @@ -7,12 +7,12 @@ namespace Babushka.scripts.CSharp.Common.CharacterControls; public partial class InteractionArea2D : Node2D { + [Export] private Area2D _area; [Export] private Label _label; [Export] private bool _active = true; [Export] private bool _useOutline = true; [Export] private ShaderMaterial _outlineMaterial; - [Export] private CanvasItem? _spriteToOutline; // keep to not break old usages. TODO: remove later [Export] private CanvasItem[] _spritesToOutline = []; [Export] private bool _showLabel = true; [Export] private int _id = -1; // TODO: remove @@ -38,21 +38,7 @@ public partial class InteractionArea2D : Node2D { if (_useOutline) { - try - { - // support old implementations of the script. If the sprite to outline is set, add it to the array - if (_spriteToOutline != null) - { - Array.Resize(ref _spritesToOutline, _spritesToOutline.Length + 1); - _spritesToOutline[^1] = _spriteToOutline; - } - - _backupMaterials = _spritesToOutline.Select(s => s.Material).ToArray(); - } - catch (Exception exception) - { - GD.PrintErr($"No sprite to outline found on: {GetParent().Name}" + exception.Message); - } + _backupMaterials = _spritesToOutline.Select(s => s.Material).ToArray(); } } @@ -76,9 +62,6 @@ public partial class InteractionArea2D : Node2D public void OnPlayerExited(Node2D player) { - if (!_active) - return; - _label.Hide(); if (!_useOutline) @@ -129,7 +112,6 @@ public partial class InteractionArea2D : Node2D public void SetSpriteActiveState(bool success, int id) // TODO: remove { - GD.PrintErr("SetSpriteActiveState is being called."); if (!_active) return; } diff --git a/scripts/CSharp/Common/Farming/FarmingControls2D.cs b/scripts/CSharp/Common/Farming/FarmingControls2D.cs index c9e259c..10014e5 100644 --- a/scripts/CSharp/Common/Farming/FarmingControls2D.cs +++ b/scripts/CSharp/Common/Farming/FarmingControls2D.cs @@ -1,3 +1,5 @@ +using System; +using Babushka.scripts.CSharp.Low_Code.Variables; using Godot; using Godot.Collections; @@ -6,19 +8,17 @@ namespace Babushka.scripts.CSharp.Common.Farming; [GlobalClass] public partial class FarmingControls2D : Node2D { - [Export] private PackedScene _fieldPrefab; + [Export] private VariableResource _sceneKeyProvider; [Export] private Node2D _movingPlayer; [Export] private Camera2D _camera; - [Export] private CpuParticles2D _wateringParticles; - [Export] private float _wateringCanParticlesVerticalOffset = 50f; - public FieldService2D FieldService; + [Export] private float _wateringCanParticlesVerticalOffset = 50f; + [Export] private Vector2I _fieldOffsetVector = new Vector2I(735, 651); + [Export] private Node2D _fieldParent; private int _toolId = -1; private bool _wateringCanFilled = false; - - [Signal] public delegate void WateringFieldEventHandler(); #region Tools @@ -49,59 +49,19 @@ public partial class FarmingControls2D : Node2D } #endregion - - public override void _Input(InputEvent @event) - { - if (@event.IsActionPressed("click") - && _toolId == WateringCanState.WATERING_CAN_ID - && WateringCanState.GetFillState() > 0) - { - Vector2I adjustedPosition = GetAdjustedMousePosition(); - WaterTheField(adjustedPosition); - } - } + private Vector2I GetAdjustedMousePosition() { Vector2 mousePosition = _camera.GetGlobalMousePosition(); Vector2I mousePositionInteger = (Vector2I) mousePosition; - Vector2I adjustedPosition = AdjustValue(mousePositionInteger, new Vector2I(735, 651)); + Vector2I adjustedPosition = AdjustValue(mousePositionInteger, _fieldOffsetVector); return adjustedPosition; } - /// - /// Called by the allowed farming area collision area 2d. - /// - /// - /// - /// - public void InputEventPressedOn(Node node, InputEvent inputEvent, int shapeIndex) + private Vector2I AdjustValue(Vector2I input, Vector2I step) { - if (!inputEvent.IsPressed()) - { - return; - } - - if (!inputEvent.IsActionPressed("click")) - return; - - if (inputEvent is InputEventMouseButton inputEventMouseButton) - { - if (!inputEventMouseButton.Pressed) - { - return; - } - } - else - { - return; - } - - if (_toolId == 0) - { - Vector2I adjustedPosition = GetAdjustedMousePosition(); - MakeField(adjustedPosition); - } + return input.Snapped(step); } #region WATERING @@ -112,57 +72,7 @@ public partial class FarmingControls2D : Node2D WateringCanState.Fill(); } } - - private void WaterTheField(Vector2I fieldPosition) - { - FieldBehaviour2D field = FieldService.Get(fieldPosition); - if (field == null || field.FieldState == FieldState.Watered) - return; - - field.Water(); - _wateringParticles.GlobalPosition = new Vector2(field.GlobalPosition.X, field.GlobalPosition.Y + _wateringCanParticlesVerticalOffset); - WateringCanState.Water(); - EmitSignal(SignalName.WateringField); - } #endregion - #region FIELD CREATION - private void MakeField(Vector2I fieldPosition) - { - if(FieldService == null || _fieldPrefab == null) - return; - - // only instantiate a field if there isn't one already. - if(FieldService.Get(fieldPosition) == null) - { - Node fieldInstance = _fieldPrefab.Instantiate(); - if (fieldInstance is Node2D field2d) - { - // add dictionary entry for the field - Array fields = field2d.FindChildren("*", nameof(FieldBehaviour2D)); - if (fields.Count > 0) - FieldService.TryAddEntry(fieldPosition, fields[0] as FieldBehaviour2D); - - // reposition and reparent the instance - field2d.Position = new Vector2(fieldPosition.X, fieldPosition.Y);; - FieldService.AddChild(fieldInstance); - } - } - } - - private int AdjustValue(float value) - { - float adjustedValue = value / 500; - adjustedValue = Mathf.RoundToInt(adjustedValue); - adjustedValue *= 500; - return (int)adjustedValue; - } - - private Vector2I AdjustValue(Vector2I input, Vector2I step) - { - return input.Snapped(step); - } - - #endregion } \ No newline at end of file diff --git a/scripts/CSharp/Common/Farming/FieldActivator.cs b/scripts/CSharp/Common/Farming/FieldActivator.cs new file mode 100644 index 0000000..f324176 --- /dev/null +++ b/scripts/CSharp/Common/Farming/FieldActivator.cs @@ -0,0 +1,54 @@ +using Babushka.scripts.CSharp.Common.CharacterControls; +using Godot; + +namespace Babushka.scripts.CSharp.Common.Farming; + +/// +/// Enables a preset field in the scene sothat it can be used for farming. +/// +public partial class FieldActivator : Node +{ + [Export] private FieldBehaviour2D _field; + [Export] private InteractionArea2D _activatorArea; + + private bool _used = false; + private bool _rakeInHand; + + [Signal] public delegate void FieldCreatedEventHandler(); + + public override void _Ready() + { + ToggleInteractionArea(); + } + + /// + /// Activates the fieldbehaviour node and sets it to the tilled state. + /// + public void ActivateField() + { + if (!_used && _rakeInHand) + { + _field.Visible = true; + _field.UpdateFieldState(FieldState.Tilled); + EmitSignal(SignalName.FieldCreated, _field); + _used = true; + } + } + + /// + /// Reacts to changes in the inventory. + /// If setup correctly, the field activator interactable should only trigger when using the rake. + /// + /// + public void RakeActivated(bool activated) + { + _rakeInHand = activated; + ToggleInteractionArea(); + } + + private void ToggleInteractionArea() + { + _activatorArea.IsActive = !_used && _rakeInHand; + } + +} \ No newline at end of file diff --git a/scripts/CSharp/Common/Farming/FieldActivator.cs.uid b/scripts/CSharp/Common/Farming/FieldActivator.cs.uid new file mode 100644 index 0000000..d98ca61 --- /dev/null +++ b/scripts/CSharp/Common/Farming/FieldActivator.cs.uid @@ -0,0 +1 @@ +uid://dlbjjgbs0n4b0 diff --git a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs index 19ad9d0..80a1254 100644 --- a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs +++ b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs @@ -1,31 +1,88 @@ using System; using Babushka.scripts.CSharp.Common.CharacterControls; using Babushka.scripts.CSharp.Common.Inventory; +using Babushka.scripts.CSharp.Common.Savegame; +using Babushka.scripts.CSharp.Low_Code.Events; +using Babushka.scripts.CSharp.Low_Code.Variables; using Godot; +using Godot.Collections; namespace Babushka.scripts.CSharp.Common.Farming; +/// +/// Defines the behaviour of the field, i.e. interactions, states and effects. +/// [GlobalClass] public partial class FieldBehaviour2D : Sprite2D { + [ExportGroup("Persistence")] + [Export] public string SaveId = ""; + [Export] private VariableNode _fieldIndex; + [Export] public VariableResource _sceneKeyProvider; + [Export] public FieldState FieldState = FieldState.Tilled; + + [ExportGroup("Field Visuals")] [Export] private Sprite2D _fieldSprite; [Export] private Sprite2D _maskSprite; + [Export] private Sprite2D _outlineSprite; + [Export] private Texture2D[] _maskOutlineTextures; [Export] private Texture2D[] _maskTexture; [Export] private Texture2D Tilled; [Export] private Texture2D Watered; - [Export] public FieldState FieldState = FieldState.Tilled; + + [ExportGroup("Field Interactions")] [Export] public InteractionArea2D PlantingInteraction; + [Export] public InteractionArea2D FieldInteractionArea; + + [ExportGroup("Configuration")] [Export] public Node2D PlantingPlaceholder; [Export] public ItemRepository ItemRepository; + [Export] private CpuParticles2D _wateringParticles; + [Export] private EventResource _wateringEvent; + + private bool _seedsActive; + private bool _wateringCanActive; + + private bool _canPlant; + private bool _canWater; + + private PlantBehaviour2D? _currentPlant; + [Signal] public delegate void PlantedEventHandler(); - public Vector2 FieldPosition; + private void UpdateInteractionArea() + { + // fieldstate == tilled / watered && samen im Inventar + _canPlant = (FieldState == FieldState.Tilled || FieldState == FieldState.Watered) && _seedsActive; + // fieldstate == tilled && watering can ausgewählt + _canWater = (FieldState == FieldState.Tilled || FieldState == FieldState.Planted) && _wateringCanActive; + FieldInteractionArea.IsActive = _canPlant || _canWater; + } + + public void ActivatedSeedInInventory(bool activated) + { + _seedsActive = activated; + UpdateInteractionArea(); + } + + public void ActivateWateringCanInInventory(bool activated) + { + _wateringCanActive = activated; + UpdateInteractionArea(); + } public override void _Ready() { + LoadFromSaveData(); + if(PlantingPlaceholder.GetChildCount() > 0) + _currentPlant = PlantingPlaceholder.GetChild(0); UpdateFieldState(FieldState); + + FieldService.Instance.TryAddEntry(_sceneKeyProvider.Payload.AsString(),_fieldIndex.Payload.AsInt32(), this); + int randomIndex = new Random().Next(0, _maskTexture.Length); _maskSprite.Texture = _maskTexture[randomIndex]; + _outlineSprite.Texture = _maskOutlineTextures[randomIndex]; base._Ready(); } @@ -56,22 +113,36 @@ public partial class FieldBehaviour2D : Sprite2D FieldState = FieldState.NotFound; break; } + UpdateInteractionArea(); + UpdateSaveData(); } public void Water() { - UpdateFieldState(FieldState.Watered); + if (WateringCanState.GetFillState() > 0) + { + UpdateFieldState(FieldState.Watered); + _wateringParticles.Emitting = true; + WateringCanState.Water(); + _wateringEvent.Raise(); + } } /// - /// Called when the player enters the field's interaction area and presses . + /// Called when the player enters the field's interaction area and presses or clicks. /// public void Farm() { - if (TryPlant()) + if (_canPlant && TryPlant()) + { + EmitSignal(SignalName.Planted); + UpdateFieldState(FieldState.Planted); + } + + if (_canWater) { - UpdateFieldState(FieldState.Planted); + Water(); } } @@ -80,30 +151,114 @@ public partial class FieldBehaviour2D : Sprite2D bool success = false; int currentSlotIndex = InventoryManager.Instance.CurrentSelectedSlotIndex; ItemInstance? item = InventoryManager.Instance.playerInventory.Slots[currentSlotIndex].itemInstance; - + if (item == null || PlantingPlaceholder.GetChildCount() > 0 || item.amount == 0) return success; - string prefabPath = ItemRepository.TryGetPrefabPath(item.blueprint); + string plantPrefabPath = ItemRepository.TryGetPrefabPath(item.blueprint); - if (prefabPath != null) + if (!string.IsNullOrEmpty(plantPrefabPath)) { - PackedScene prefab = ResourceLoader.Load(prefabPath, nameof(PackedScene)); - Node2D plant2d = prefab.Instantiate(); - PlantingPlaceholder.AddChild(plant2d); - plant2d.GlobalPosition = PlantingPlaceholder.GlobalPosition; - PlantBehaviour2D? plantBehaviour = plant2d as PlantBehaviour2D; - - if (plantBehaviour != null) - { - plantBehaviour.Field = this; - } - + PlantPrefab(plantPrefabPath); InventoryManager.Instance.playerInventory.RemoveItem(currentSlotIndex); success = true; } - + return success; } -} \ No newline at end of file + private void PlantPrefab(string prefabPath) + { + PackedScene prefab = ResourceLoader.Load(prefabPath, nameof(PackedScene)); + Node2D plant2d = prefab.Instantiate(); + PlantingPlaceholder.AddChild(plant2d); + plant2d.GlobalPosition = PlantingPlaceholder.GlobalPosition; + _currentPlant = plant2d as PlantBehaviour2D; + + if (_currentPlant != null) + { + _currentPlant.Field = this; + } + } + + #region SAVE AND LOAD + + public void UpdateSaveData() + { + var saveData = new SaveData(); + + saveData.SceneName = _sceneKeyProvider.Payload.AsString(); + saveData.Id = SaveId + _fieldIndex.Payload.AsString(); + var payloadData = new Dictionary + { + { "field_state", (int)FieldState } + }; + + if (_currentPlant != null) + { + payloadData.Add( + "plant_data", new Dictionary() + { + { "prefab_path", _currentPlant.PrefabPath }, + { "plant_state", (int)_currentPlant.State }, + { "plant_days_growing", _currentPlant.DaysGrowing } + } + ); + } + + saveData.JsonPayload = Json.Stringify(payloadData, indent: "\t"); + + SavegameService.AppendSave(saveData); + } + + public void LoadFromSaveData() + { + var sceneName = _sceneKeyProvider.Payload.AsString(); + var id = SaveId + _fieldIndex.Payload.AsString(); + string jsonPayload = SavegameService.GetSaveData(sceneName, id); + Dictionary save = Json.ParseString(jsonPayload).AsGodotDictionary(); + + if (save.Count > 0) + { + if (save.TryGetValue("field_state", out Variant fieldStateVar)) + { + int fieldStateInt = fieldStateVar.AsInt32(); + FieldState = (FieldState) fieldStateInt; + + if (fieldStateInt != 0) + { + Visible = true; + UpdateFieldState(FieldState); + } + } + + if (save.TryGetValue("plant_data", out Variant plantDataVar)) + { + Dictionary plantDataDict = plantDataVar.AsGodotDictionary(); + + if (plantDataDict.TryGetValue("prefab_path", out Variant prefabPathVar)) + { + PlantPrefab(prefabPathVar.AsString()); + } + else + { + return; + } + + if (plantDataDict.TryGetValue("plant_state", out Variant plantStateVar) && _currentPlant != null) + { + _currentPlant.State = (PlantState) plantStateVar.AsInt32(); + _currentPlant.GrowPlant(); + } + + if (plantDataDict.TryGetValue("plant_days_growing", out Variant plantDaysGrowingVar) && _currentPlant != null) + { + _currentPlant.DaysGrowing = plantDaysGrowingVar.AsInt32(); + } + + } + } + } +#endregion + +} diff --git a/scripts/CSharp/Common/Farming/FieldService.cs b/scripts/CSharp/Common/Farming/FieldService.cs new file mode 100644 index 0000000..197e7c9 --- /dev/null +++ b/scripts/CSharp/Common/Farming/FieldService.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; +using Godot; + +namespace Babushka.scripts.CSharp.Common.Farming; + +public partial class FieldService : Node +{ + private Dictionary? _outerDict = null!; + public static FieldService Instance { get; private set; } = null!; + + public override void _EnterTree() + { + Instance = this; + _outerDict = new Dictionary(); + } + + public override void _ExitTree() + { + Instance = null; + _outerDict = null; + } + + + //Create + public bool TryAddEntry(string sceneName, int fieldIndex, FieldBehaviour2D field) + { + if (_outerDict != null ) + { + FieldsInScene innerDict; + bool outerDictEntryExists = _outerDict.TryGetValue(sceneName, out innerDict); + + if (!outerDictEntryExists) + { + innerDict = new FieldsInScene(); + _outerDict.Add(sceneName, innerDict); + } + + if (!innerDict.fields.ContainsKey(fieldIndex)) + { + innerDict.fields.Add(fieldIndex, field); + return true; + } + } + return false; + } + + // Read + public FieldBehaviour2D? TryGet(string key, int fieldIndex) + { + if (_outerDict != null && _outerDict.TryGetValue(key, out FieldsInScene? field)) + { + if (field.fields.TryGetValue(fieldIndex, out FieldBehaviour2D? fieldInstance)) + { + return fieldInstance; + } + } + return null; + } + + + //Update + public void UpdateEntry(string key, int fieldIndex, FieldBehaviour2D state) + { + if (_outerDict != null && _outerDict.TryGetValue(key, out FieldsInScene? field)) + { + if (field.fields.ContainsKey(fieldIndex)) + { + field.fields[fieldIndex] = state; + } + else + { + TryAddEntry(key, fieldIndex, state); + } + } + } + + //Delete + public void RemoveEntry(string key, int fieldIndex) + { + if (_outerDict != null && _outerDict.TryGetValue(key, out FieldsInScene? field)) + { + if (field.fields.ContainsKey(fieldIndex)) + { + field.fields.Remove(fieldIndex); + } + } + } +} + +internal class FieldsInScene +{ + public Dictionary fields; + + public FieldsInScene() + { + fields = new Dictionary(); + } +} + + diff --git a/scripts/CSharp/Common/Farming/FieldService.cs.uid b/scripts/CSharp/Common/Farming/FieldService.cs.uid new file mode 100644 index 0000000..42d3b36 --- /dev/null +++ b/scripts/CSharp/Common/Farming/FieldService.cs.uid @@ -0,0 +1 @@ +uid://slo0uydmmvnu diff --git a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs index 6a3439a..82cdeaf 100644 --- a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs +++ b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs @@ -1,17 +1,15 @@ using System; -using Babushka.scripts.CSharp.Common.Animation; using Babushka.scripts.CSharp.Common.Inventory; using Godot; namespace Babushka.scripts.CSharp.Common.Farming; - - /// /// Determines the behaviour of a plant in Babushka. /// public partial class PlantBehaviour2D : Node2D { + [Export] private string _prefabPath; [Export] private Sprite2D[] _seeds; [Export] private Sprite2D[] _smallPlants; [Export] private Sprite2D[] _bigPlants; @@ -23,8 +21,19 @@ public partial class PlantBehaviour2D : Node2D [Export] private bool _magicWordNeeded = true; private string _magicWordDialogicEventName = "MagicWord"; - private Sprite2D _currentPlantSprite = null; + private Sprite2D? _currentPlantSprite = null; private bool _magicWordSaid = false; + private bool _calledOnReady = false; + + public PlantState State + { + get => _state; + set => _state = value; + } + + public int DaysGrowing { get; set; } + + public string PrefabPath => _prefabPath; /// /// public accessor for the field reference @@ -39,20 +48,19 @@ public partial class PlantBehaviour2D : Node2D { if (_state == PlantState.None) { - GetTree().CallGroup("PlantGrowing", VesnaAnimations.MethodName.PlayFarmingAnimation); _state = PlantState.Planted; _currentPlantSprite = GetRandomSprite(_seeds); _currentPlantSprite.Visible = true; } else { + _calledOnReady = true; GrowPlant(); } } public void Grow() { - GetTree().CallGroup("PlantGrowing", VesnaAnimations.MethodName.PlayFarmingAnimation); GrowPlant(); } @@ -62,8 +70,11 @@ public partial class PlantBehaviour2D : Node2D /// public void GrowPlant() { - if (_field.FieldState != FieldState.Watered || _magicWordSaid != _magicWordNeeded) - return; + if (!_calledOnReady) + { + if (_field.FieldState != FieldState.Watered || _magicWordSaid != _magicWordNeeded) + return; + } switch (_state) { @@ -107,6 +118,7 @@ public partial class PlantBehaviour2D : Node2D _field.UpdateFieldState(FieldState.Tilled); _magicWordSaid = false; + _calledOnReady = false; } private Sprite2D GetRandomSprite(Sprite2D[] sprites) diff --git a/scripts/CSharp/Common/Farming/VesnaBehaviour2D.cs b/scripts/CSharp/Common/Farming/VesnaBehaviour2D.cs index 3bbe17c..46c9c19 100644 --- a/scripts/CSharp/Common/Farming/VesnaBehaviour2D.cs +++ b/scripts/CSharp/Common/Farming/VesnaBehaviour2D.cs @@ -9,7 +9,6 @@ namespace Babushka.scripts.CSharp.Common.Farming; public partial class VesnaBehaviour2D : Node { [ExportGroup("Farming")] - [Export] private FieldService2D _fieldParent; [Export] private FarmingControls2D _farmingControls; [Export] private PlayerMovement _player2d; [Export] private VesnaAnimations _vesnaAnimations; @@ -26,7 +25,6 @@ public partial class VesnaBehaviour2D : Node public override void _Ready() { - _farmingControls.FieldService = _fieldParent; _inventoryManager = InventoryManager.Instance; _inventoryInstance = _inventoryManager.playerInventory; _inventoryManager.SlotIndexChanged += HandleInventorySelectedSlotIndexChanged; diff --git a/scripts/CSharp/Common/Inventory/InventoryListener.cs b/scripts/CSharp/Common/Inventory/InventoryListener.cs new file mode 100644 index 0000000..424ebb1 --- /dev/null +++ b/scripts/CSharp/Common/Inventory/InventoryListener.cs @@ -0,0 +1,48 @@ +using Godot; + +namespace Babushka.scripts.CSharp.Common.Inventory; + +public partial class InventoryListener : Node +{ + [Export] private ItemResource[] _itemResourcesToListenFor; + + [Signal] public delegate void ItemInstanceActivatedEventHandler(bool activated); + + public override void _Ready() + { + InventoryManager.Instance.playerInventory.InventoryContentsChanged += HandleNewItemInInventory; + InventoryManager.Instance.SlotIndexChanged += HandleNewItemInInventory; + } + + public override void _ExitTree() + { + InventoryManager.Instance.playerInventory.InventoryContentsChanged -= HandleNewItemInInventory; + InventoryManager.Instance.SlotIndexChanged -= HandleNewItemInInventory; + } + + private void HandleNewItemInInventory(int newIndex) + { + HandleNewItemInInventory(); + } + + private void HandleNewItemInInventory() + { + int currentSlotIndex = InventoryManager.Instance.CurrentSelectedSlotIndex; + ItemInstance? instance = InventoryManager.Instance.playerInventory.Slots[currentSlotIndex].itemInstance; + if (instance != null) + { + ItemResource? item = instance.blueprint; + + foreach (var res in _itemResourcesToListenFor) + { + if (item == res) + { + EmitSignal(SignalName.ItemInstanceActivated, true); + return; + } + } + } + + EmitSignal(SignalName.ItemInstanceActivated, false); + } +} \ No newline at end of file diff --git a/scripts/CSharp/Common/Inventory/InventoryListener.cs.uid b/scripts/CSharp/Common/Inventory/InventoryListener.cs.uid new file mode 100644 index 0000000..42f5a8b --- /dev/null +++ b/scripts/CSharp/Common/Inventory/InventoryListener.cs.uid @@ -0,0 +1 @@ +uid://3t0af586fimq diff --git a/scripts/CSharp/Common/Items/NonInventoryPickup.cs b/scripts/CSharp/Common/Items/NonInventoryPickup.cs deleted file mode 100644 index 1124923..0000000 --- a/scripts/CSharp/Common/Items/NonInventoryPickup.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Babushka.scripts.CSharp.Common.Animation; -using Godot; - -namespace Babushka.scripts.CSharp.Common.Items; - -public partial class NonInventoryPickup : Node2D -{ - public void PlayPickupAnimation() - { - // todo: replace with EventBus implementation as soon as this is possible - GetTree().CallGroup("Pickup", VesnaAnimations.MethodName.PlayPickUpAnimation); - } -} \ No newline at end of file diff --git a/scripts/CSharp/Common/Items/NonInventoryPickup.cs.uid b/scripts/CSharp/Common/Items/NonInventoryPickup.cs.uid deleted file mode 100644 index 699a9ee..0000000 --- a/scripts/CSharp/Common/Items/NonInventoryPickup.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dkk1vjijvgrd7 diff --git a/scripts/CSharp/Common/Savegame/SaveData.cs b/scripts/CSharp/Common/Savegame/SaveData.cs new file mode 100644 index 0000000..1a7e3a8 --- /dev/null +++ b/scripts/CSharp/Common/Savegame/SaveData.cs @@ -0,0 +1,20 @@ +using System; + +namespace Babushka.scripts.CSharp.Common.Savegame; + +/// +/// Central structure for SaveData entries. +/// SceneName and ID are later combined and used as keys for the save system. +/// +[Serializable] +public class SaveData +{ + public string SceneName; + public string Id; + public string JsonPayload; + + public string ToString() + { + return SceneName + " " + Id + " " + JsonPayload; + } +} \ No newline at end of file diff --git a/scripts/CSharp/Common/Savegame/SaveData.cs.uid b/scripts/CSharp/Common/Savegame/SaveData.cs.uid new file mode 100644 index 0000000..e46f0d7 --- /dev/null +++ b/scripts/CSharp/Common/Savegame/SaveData.cs.uid @@ -0,0 +1 @@ +uid://bkftl5mj33eah diff --git a/scripts/CSharp/Common/Savegame/SaveGameManager.cs b/scripts/CSharp/Common/Savegame/SaveGameManager.cs new file mode 100644 index 0000000..9d53244 --- /dev/null +++ b/scripts/CSharp/Common/Savegame/SaveGameManager.cs @@ -0,0 +1,19 @@ +using Godot; + +namespace Babushka.scripts.CSharp.Common.Savegame; + +/// +/// This class manages the loading of the savegame throughout the gameplay flow. +/// +public partial class SaveGameManager : Node +{ + public static SaveGameManager? Instance { get; private set; } = null!; + + public override void _EnterTree() + { + Instance = this; + + SavegameService.Load(); + } + +} \ No newline at end of file diff --git a/scripts/CSharp/Common/Savegame/SaveGameManager.cs.uid b/scripts/CSharp/Common/Savegame/SaveGameManager.cs.uid new file mode 100644 index 0000000..8c4c6e5 --- /dev/null +++ b/scripts/CSharp/Common/Savegame/SaveGameManager.cs.uid @@ -0,0 +1 @@ +uid://c1srnefvhigef diff --git a/scripts/CSharp/Common/Savegame/SavegameService.cs b/scripts/CSharp/Common/Savegame/SavegameService.cs new file mode 100644 index 0000000..d3a3fef --- /dev/null +++ b/scripts/CSharp/Common/Savegame/SavegameService.cs @@ -0,0 +1,97 @@ +using System; +using Godot; +using Godot.Collections; +using FileAccess = Godot.FileAccess; + +namespace Babushka.scripts.CSharp.Common.Savegame; + +/// +/// Handles the saving and loading of game states. +/// Holds the central SaveData object that serves as a temporary SaveFile. +/// Automatically writes to disk on every scene change. +/// +public static class SavegameService +{ + public static readonly string SavePath = "user://babushka_savegame.json"; + + public static Dictionary SaveDatas = new (); + + public static bool _loaded = false; + + + /// + /// Adds or overwrites an entry in the SaveData dictionary. + /// + /// + public static void AppendSave(SaveData saveData) + { + string key = string.Concat(saveData.SceneName, "_", saveData.Id); + + if (SaveDatas.TryGetValue(key, out var value)) + { + SaveDatas[key] = saveData.JsonPayload; + } + else + { + SaveDatas.Add(key, saveData.JsonPayload); + } + } + + + /// + /// Checks the SaveData dictionary for an entry and returns the jsondata as a string for it. + /// Requires the scenename and object ID for lookup. + /// + /// + /// + /// + public static string GetSaveData(string sceneName, string id) + { + string saveData = ""; + + string key = string.Concat(sceneName, "_", id); + + if (!_loaded) + { + GD.Print("SavegameService: SaveFile not loaded."); + return saveData; + } + + if (SaveDatas.ContainsKey(key)) + { + saveData = SaveDatas[key]; + } + + return saveData; + } + + + /// + /// Writes the contents of the current SaveData dictionary to disk as a json file. + /// + public static void Save() + { + string json = Json.Stringify(SaveDatas, indent: "\t"); + using var file = FileAccess.Open(SavePath, FileAccess.ModeFlags.Write); + file.StoreString(json); + } + + /// + /// Loads the current savegame file from disk and parses it into the SaveData dictionary. + /// + public static void Load() + { + try + { + string saveDataJson = FileAccess.GetFileAsString(SavePath); + SaveDatas = Json.ParseString(saveDataJson).AsGodotDictionary(); + } + catch(Exception e) + { + GD.PrintRich(e.Message); + return; + } + + _loaded = true; + } +} \ No newline at end of file diff --git a/scripts/CSharp/Common/Savegame/SavegameService.cs.uid b/scripts/CSharp/Common/Savegame/SavegameService.cs.uid new file mode 100644 index 0000000..e793998 --- /dev/null +++ b/scripts/CSharp/Common/Savegame/SavegameService.cs.uid @@ -0,0 +1 @@ +uid://rm23q50boqe5 diff --git a/scripts/CSharp/Common/SceneTransition.cs b/scripts/CSharp/Common/SceneTransition.cs index e6c5426..7709acb 100644 --- a/scripts/CSharp/Common/SceneTransition.cs +++ b/scripts/CSharp/Common/SceneTransition.cs @@ -1,3 +1,4 @@ +using Babushka.scripts.CSharp.Common.Savegame; using Babushka.scripts.CSharp.Common.SceneManagement; using Godot; @@ -16,6 +17,7 @@ public partial class SceneTransition : Node public void LoadSceneAtIndex(int index) { + SavegameService.Save(); string sceneName = _sceneNamesToLoad[index]; SceneTransitionThreaded.Instance.ChangeSceneToFileThreaded(sceneName); UnloadAfterDelay(); diff --git a/scripts/CSharp/Common/Util/NodeExtension.cs b/scripts/CSharp/Common/Util/NodeExtension.cs index 07eaa81..52e8477 100644 --- a/scripts/CSharp/Common/Util/NodeExtension.cs +++ b/scripts/CSharp/Common/Util/NodeExtension.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Godot; namespace Babushka.scripts.CSharp.Common.Util; @@ -23,4 +24,54 @@ public static class NodeExtension } throw new Exception($"Parent of type {typeof(T)} not found for node {self.Name}"); } + + //acts like Unity's GetComponent / GetComponentInChildren + // only works with Godot's built-in types. + public static T GetChildByType(this Node node, bool recursive = true) + where T : Node + { + int childCount = node.GetChildCount(); + + for (int i = 0; i < childCount; i++) + { + Node child = node.GetChild(i); + if (child is T childT) + return childT; + + if (recursive && child.GetChildCount() > 0) + { + T recursiveResult = child.GetChildByType(true); + if (recursiveResult != null) + return recursiveResult; + } + } + + return null; + } + + /// + /// Another reimplementation of Unity's GetComponent. + /// Verified to work with all types, also derived ones, but only when used from within a scene and at runtime. + /// + /// + /// + /// + public static T GetComponent(Node node) + { + if (node is T) + { + return (T)(object)node; + } + + foreach (Node child in node.GetChildren()) + { + if (child is T) + { + return (T)(object)child; + } + } + + return (T)(object)null; + } + } diff --git a/scripts/CSharp/Low Code/Variables/VariableNode.cs b/scripts/CSharp/Low Code/Variables/VariableNode.cs new file mode 100644 index 0000000..a979ee0 --- /dev/null +++ b/scripts/CSharp/Low Code/Variables/VariableNode.cs @@ -0,0 +1,11 @@ +using Godot; + +namespace Babushka.scripts.CSharp.Low_Code.Variables; + +/// +/// A Node type that carries a Variant payload. +/// +public partial class VariableNode : Node +{ + [Export] public Variant Payload { get; set; } +} \ No newline at end of file diff --git a/scripts/CSharp/Low Code/Variables/VariableNode.cs.uid b/scripts/CSharp/Low Code/Variables/VariableNode.cs.uid new file mode 100644 index 0000000..a777d02 --- /dev/null +++ b/scripts/CSharp/Low Code/Variables/VariableNode.cs.uid @@ -0,0 +1 @@ +uid://j2mhvb45egej diff --git a/scripts/CSharp/Low Code/Variables/VariableSetter.cs b/scripts/CSharp/Low Code/Variables/VariableSetter.cs new file mode 100644 index 0000000..cdde4cf --- /dev/null +++ b/scripts/CSharp/Low Code/Variables/VariableSetter.cs @@ -0,0 +1,14 @@ +using Godot; + +namespace Babushka.scripts.CSharp.Low_Code.Variables; + +public partial class VariableSetter : Node +{ + [Export] private VariableResource _variableResource; + [Export] private Variant _payloadToSet; + + public void Set() + { + _variableResource.Payload = _payloadToSet; + } +} \ No newline at end of file diff --git a/scripts/CSharp/Low Code/Variables/VariableSetter.cs.uid b/scripts/CSharp/Low Code/Variables/VariableSetter.cs.uid new file mode 100644 index 0000000..34c1435 --- /dev/null +++ b/scripts/CSharp/Low Code/Variables/VariableSetter.cs.uid @@ -0,0 +1 @@ +uid://dfpyjxivcuidr diff --git a/AnimationFix.gd b/scripts/GdScript/AnimationFix.gd similarity index 100% rename from AnimationFix.gd rename to scripts/GdScript/AnimationFix.gd diff --git a/AnimationFix.gd.uid b/scripts/GdScript/AnimationFix.gd.uid similarity index 100% rename from AnimationFix.gd.uid rename to scripts/GdScript/AnimationFix.gd.uid