WIP moving seed to plant matching into separate system, making fields independent of specific plants.

feature/showcase_bugfixing_kathi_partII_quickfix
kziolkowski 5 months ago
parent 41365fb5d4
commit ce2d7eb773

@ -1,6 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArea3D_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F8a54226fa2e1c9371a8091f24cfd744aef11fe6869527dc23b9b837623a29b9_003FArea3D_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArea3D_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F8a54226fa2e1c9371a8091f24cfd744aef11fe6869527dc23b9b837623a29b9_003FArea3D_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAudioStreamPlayer2D_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F848324b1c23114c3f5e8bbb5a42c4ade394c59a7a7a133a66b76581ca571_003FAudioStreamPlayer2D_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAudioStreamPlayer2D_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F848324b1c23114c3f5e8bbb5a42c4ade394c59a7a7a133a66b76581ca571_003FAudioStreamPlayer2D_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABabushka_002Escripts_002ECSharp_002ECommon_002EFarming_002EFieldBehaviour2D_005FScriptMethods_002Egenerated_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F75d11718f1abbc2572fd32e4b83acbec9d79ac_003FBabushka_002Escripts_002ECSharp_002ECommon_002EFarming_002EFieldBehaviour2D_005FScriptMethods_002Egenerated_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABabushka_002Escripts_002ECSharp_002ECommon_002EFarming_002EVesnaBehaviour2D_005FScriptProperties_002Egenerated_002Ecs_002Fl_003AC_0021_003FUsers_003FJonathan_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F4298b0f293f987511fc1b7956ee691fd778f8378_003FBabushka_002Escripts_002ECSharp_002ECommon_002EFarming_002EVesnaBehaviour2D_005FScriptProperties_002Egenerated_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABabushka_002Escripts_002ECSharp_002ECommon_002EFarming_002EVesnaBehaviour2D_005FScriptProperties_002Egenerated_002Ecs_002Fl_003AC_0021_003FUsers_003FJonathan_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F4298b0f293f987511fc1b7956ee691fd778f8378_003FBabushka_002Escripts_002ECSharp_002ECommon_002EFarming_002EVesnaBehaviour2D_005FScriptProperties_002Egenerated_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABabushka_002Escripts_002ECSharp_002ECommon_002EQuest_002EQuestListItemUi_005FScriptMethods_002Egenerated_002Ecs_002Fl_003AC_0021_003FUsers_003FJonathan_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F48fad7e7f3c9e292b3fdbddf9d363f0d1752aa_003FBabushka_002Escripts_002ECSharp_002ECommon_002EQuest_002EQuestListItemUi_005FScriptMethods_002Egenerated_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABabushka_002Escripts_002ECSharp_002ECommon_002EQuest_002EQuestListItemUi_005FScriptMethods_002Egenerated_002Ecs_002Fl_003AC_0021_003FUsers_003FJonathan_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F48fad7e7f3c9e292b3fdbddf9d363f0d1752aa_003FBabushka_002Escripts_002ECSharp_002ECommon_002EQuest_002EQuestListItemUi_005FScriptMethods_002Egenerated_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACastHelpers_002Ecs_002Fl_003AC_0021_003FUsers_003FJonathan_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F3c92637ae2e83da0a63791071c41eae291d594156062866d8621b7ed7245c_003FCastHelpers_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACastHelpers_002Ecs_002Fl_003AC_0021_003FUsers_003FJonathan_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F3c92637ae2e83da0a63791071c41eae291d594156062866d8621b7ed7245c_003FCastHelpers_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

@ -473,7 +473,7 @@
[ext_resource type="Texture2D" uid="uid://3pj2q7wtuion" path="res://art/farm/farming/farmobjekte/hoe.png" id="815_1ia2b"] [ext_resource type="Texture2D" uid="uid://3pj2q7wtuion" path="res://art/farm/farming/farmobjekte/hoe.png" id="815_1ia2b"]
[ext_resource type="Texture2D" uid="uid://x8hr8287ff2n" path="res://art/farm/farming/farmobjekte/tools atlas.png" id="816_1a3c1"] [ext_resource type="Texture2D" uid="uid://x8hr8287ff2n" path="res://art/farm/farming/farmobjekte/tools atlas.png" id="816_1a3c1"]
[ext_resource type="Script" uid="uid://bcskt5ckh3rqa" path="res://scripts/CSharp/Common/Farming/FarmingControls2D.cs" id="817_6nrw3"] [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/tomato_field.tscn" id="818_16w6h"] [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"] [ext_resource type="Script" uid="uid://cvkw4qd2hxksi" path="res://scripts/GdScript/dialogic_toggle.gd" id="819_4na52"]
[sub_resource type="CircleShape2D" id="CircleShape2D_ssqtd"] [sub_resource type="CircleShape2D" id="CircleShape2D_ssqtd"]

@ -0,0 +1,40 @@
[gd_scene load_steps=8 format=3 uid="uid://b1d2e7ely6hyw"]
[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://eg5ej0mtuac" path="res://art/masks/field_outline_2.png" id="3_c014y"]
[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"]
[node name="BaseField" type="Node2D"]
[node name="FieldBehaviour" type="Sprite2D" parent="." node_paths=PackedStringArray("_fieldSprite", "_maskSprite", "PlantingInteraction", "PlantingPlaceholder")]
z_index = -1
scale = Vector2(0.9, 1)
script = ExtResource("1_qa01x")
_fieldSprite = NodePath("MaskedField/FieldTexture")
_maskSprite = NodePath("MaskedField")
_maskTexture = Array[Texture2D]([ExtResource("2_w8caw"), ExtResource("3_c014y"), ExtResource("4_teirr")])
Tilled = ExtResource("5_wx561")
Watered = ExtResource("6_7m4xq")
PlantingInteraction = NodePath("../InteractionArea")
PlantingPlaceholder = NodePath("PlantPlaceholder")
[node name="MaskedField" type="Sprite2D" parent="FieldBehaviour"]
clip_children = 1
scale = Vector2(1.5, 1.5)
texture = ExtResource("3_c014y")
[node name="FieldTexture" type="Sprite2D" parent="FieldBehaviour/MaskedField"]
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)
_active = false
_spriteToOutline = NodePath("../FieldBehaviour/MaskedField/FieldTexture")
[connection signal="Interacted" from="InteractionArea" to="FieldBehaviour" method="Farm"]

@ -1,54 +0,0 @@
[gd_scene load_steps=10 format=3 uid="uid://b1d2e7ely6hyw"]
[ext_resource type="Script" uid="uid://bdffon388rkty" path="res://scripts/CSharp/Common/Farming/FieldBehaviour2D.cs" id="2_vl3uw"]
[ext_resource type="Texture2D" uid="uid://cgmu3qlovdr22" path="res://art/masks/field_outline_1.png" id="3_uqkef"]
[ext_resource type="Texture2D" uid="uid://eg5ej0mtuac" path="res://art/masks/field_outline_2.png" id="4_di17a"]
[ext_resource type="Texture2D" uid="uid://djpigvoyadvjs" path="res://art/masks/field_outline_3.png" id="5_4a8nv"]
[ext_resource type="Texture2D" uid="uid://c2pirgay3jfnn" path="res://art/farm/tilable grounds/böden/trockene farming erde.png" id="6_l7j4c"]
[ext_resource type="Texture2D" uid="uid://ctvdxwgmfaj5c" path="res://art/farm/tilable grounds/böden/nasse farming erde.png" id="7_f504p"]
[ext_resource type="PackedScene" uid="uid://gishbn0a8eke" path="res://prefabs/farm/tomato_plant.tscn" id="8_jrdc4"]
[sub_resource type="CircleShape2D" id="CircleShape2D_jrdc4"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_l0vvv"]
resource_local_to_scene = true
radius = 300.0
[node name="BaseField" type="Node2D"]
[node name="FieldBehaviour" type="Sprite2D" parent="." node_paths=PackedStringArray("_fieldSprite", "_maskSprite", "_growingCollider")]
z_index = -1
scale = Vector2(0.9, 1)
script = ExtResource("2_vl3uw")
_fieldSprite = NodePath("MaskedField/FieldTexture")
_maskSprite = NodePath("MaskedField")
_maskTexture = Array[Texture2D]([ExtResource("3_uqkef"), ExtResource("4_di17a"), ExtResource("5_4a8nv")])
Tilled = ExtResource("6_l7j4c")
Watered = ExtResource("7_f504p")
_growingCollider = NodePath("BasePlant2/GrowingInteractionArea")
[node name="BasePlant2" parent="FieldBehaviour" node_paths=PackedStringArray("_field") groups=["PlantGrowing"] instance=ExtResource("8_jrdc4")]
visible = false
_field = NodePath("..")
_magicWordNeeded = false
[node name="CollisionShape3D" parent="FieldBehaviour/BasePlant2/GrowingInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_jrdc4")
[node name="CollisionShape3D" parent="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_l0vvv")
[node name="MaskedField" type="Sprite2D" parent="FieldBehaviour"]
clip_children = 1
scale = Vector2(1.5, 1.5)
texture = ExtResource("4_di17a")
[node name="FieldTexture" type="Sprite2D" parent="FieldBehaviour/MaskedField"]
texture = ExtResource("6_l7j4c")
[editable path="FieldBehaviour/BasePlant2"]
[editable path="FieldBehaviour/BasePlant2/GrowingInteractionArea"]
[editable path="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem"]
[editable path="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem/PickupInteractionArea"]

@ -0,0 +1,11 @@
[gd_scene load_steps=4 format=3 uid="uid://bqjx3luofm6yi"]
[ext_resource type="Script" uid="uid://coqch6yjvjuc0" path="res://scripts/CSharp/Common/Farming/SeedRepository.cs" id="1_i7nvs"]
[ext_resource type="Resource" uid="uid://d1uuxp1lp4aro" path="res://resources/items/tomato_seed.tres" id="2_jetk1"]
[ext_resource type="PackedScene" uid="uid://gishbn0a8eke" path="res://prefabs/farm/tomato_plant.tscn" id="3_ulp3m"]
[node name="SeedRepository" type="Node2D"]
script = ExtResource("1_i7nvs")
seedToPlantRepository = Dictionary[Object, Node]({
ExtResource("2_jetk1"): ExtResource("3_ulp3m")
})

@ -32,6 +32,7 @@ Signal_Debugger="*res://addons/SignalVisualizer/Debugger/SignalDebugger.gd"
QuestManager="*res://prefabs/quests/quest_manager_autoload.tscn" QuestManager="*res://prefabs/quests/quest_manager_autoload.tscn"
FightManagerAutoload="*res://prefabs/fight/fight_manager_autoload.tscn" FightManagerAutoload="*res://prefabs/fight/fight_manager_autoload.tscn"
InputService="*res://scripts/CSharp/Common/Services/InputService.cs" InputService="*res://scripts/CSharp/Common/Services/InputService.cs"
SeedRepository="*res://prefabs/seed_repository.tscn"
[dialogic] [dialogic]

@ -1,4 +1,4 @@
[gd_scene load_steps=119 format=3 uid="uid://gigb28qk8t12"] [gd_scene load_steps=114 format=3 uid="uid://gigb28qk8t12"]
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Player2D.tscn" id="1_7wfwe"] [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"] [ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"]
@ -30,15 +30,13 @@
[ext_resource type="PackedScene" uid="uid://dfvgp1my5rydh" path="res://prefabs/characters/Yeli.tscn" id="24_wtdui"] [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="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://dpbbroif2tnil" path="res://prefabs/interactions/generic_item_on_ground_2d.tscn" id="25_hukxv"]
[ext_resource type="Resource" uid="uid://c5yg3lx756v4v" path="res://resources/items/hoe.tres" id="26_ipqaa"]
[ext_resource type="Resource" uid="uid://c7viddcd3kywp" path="res://resources/items/shovel.tres" id="27_ipqaa"]
[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="27_klb81"] [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"] [ext_resource type="Resource" uid="uid://dlcmqfjvgphqu" path="res://resources/items/rake.tres" id="28_6b2nr"]
[ext_resource type="Resource" uid="uid://cndd64batns31" path="res://resources/items/wateringcan.tres" id="28_ipqaa"] [ext_resource type="Resource" uid="uid://cndd64batns31" path="res://resources/items/wateringcan.tres" id="28_ipqaa"]
[ext_resource type="Resource" uid="uid://datee0flk1e84" path="res://resources/items/scythe.tres" id="29_wtdui"]
[ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="32_2nee2"] [ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="32_2nee2"]
[ext_resource type="Script" uid="uid://boehox1ydbcnx" path="res://scripts/CSharp/Common/Farming/WellBehaviour.cs" id="32_lbnqo"] [ext_resource type="Script" uid="uid://boehox1ydbcnx" path="res://scripts/CSharp/Common/Farming/WellBehaviour.cs" id="32_lbnqo"]
[ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="34_e5b7x"] [ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="34_e5b7x"]
[ext_resource type="Resource" uid="uid://d1uuxp1lp4aro" path="res://resources/items/tomato_seed.tres" id="35_64mdn"]
[ext_resource type="Texture2D" uid="uid://65e44yde224q" path="res://art/farm/Babushka_house_01.png" id="36_e5b7x"] [ext_resource type="Texture2D" uid="uid://65e44yde224q" path="res://art/farm/Babushka_house_01.png" id="36_e5b7x"]
[ext_resource type="AudioStream" uid="uid://cfqg50am0swb7" path="res://audio/Music/Farming_90BPM_69Bars_Loop.wav" id="37_8ey8m"] [ext_resource type="AudioStream" uid="uid://cfqg50am0swb7" path="res://audio/Music/Farming_90BPM_69Bars_Loop.wav" id="37_8ey8m"]
[ext_resource type="AudioStream" uid="uid://dku1rq5cocisg" path="res://audio/Music/Farming_90BPM_69Bars.wav" id="37_di1ed"] [ext_resource type="AudioStream" uid="uid://dku1rq5cocisg" path="res://audio/Music/Farming_90BPM_69Bars.wav" id="37_di1ed"]
@ -165,10 +163,6 @@ size = Vector2(1041, 368)
resource_local_to_scene = true resource_local_to_scene = true
radius = 371.058 radius = 371.058
[sub_resource type="CircleShape2D" id="CircleShape2D_ycj14"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_2065p"] [sub_resource type="CircleShape2D" id="CircleShape2D_2065p"]
resource_local_to_scene = true resource_local_to_scene = true
radius = 300.0 radius = 300.0
@ -177,14 +171,6 @@ radius = 300.0
resource_local_to_scene = true resource_local_to_scene = true
radius = 300.0 radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_lbnqo"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_l4wxt"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_lhtpe"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_lhtpe"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_bcdgk"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_bcdgk"]
@ -1083,16 +1069,6 @@ _id = 1
position = Vector2(146, -130) position = Vector2(146, -130)
shape = SubResource("CircleShape2D_p6n74") shape = SubResource("CircleShape2D_p6n74")
[node name="HoeGenericPickup" parent="YSorted" instance=ExtResource("25_hukxv")]
visible = false
position = Vector2(6095, 2087)
[node name="SpawnWithItem" parent="YSorted/HoeGenericPickup" index="0"]
_blueprint = ExtResource("26_ipqaa")
[node name="CollisionShape3D" parent="YSorted/HoeGenericPickup/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_ycj14")
[node name="CanGenericPickup" parent="YSorted" instance=ExtResource("25_hukxv")] [node name="CanGenericPickup" parent="YSorted" instance=ExtResource("25_hukxv")]
position = Vector2(8192, 3507) position = Vector2(8192, 3507)
@ -1114,25 +1090,15 @@ _blueprint = ExtResource("28_6b2nr")
[node name="CollisionShape3D" parent="YSorted/RakeGenericPickup/PickupInteractionArea/Area2D" index="0"] [node name="CollisionShape3D" parent="YSorted/RakeGenericPickup/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_tm0yg") shape = SubResource("CircleShape2D_tm0yg")
[node name="ScytheGenericPickup" parent="YSorted" instance=ExtResource("25_hukxv")] [node name="SeedPickup" parent="YSorted" instance=ExtResource("25_hukxv")]
visible = false position = Vector2(10114, 2469)
position = Vector2(15642, 2158) _infiniteSupply = true
[node name="SpawnWithItem" parent="YSorted/ScytheGenericPickup" index="0"]
_blueprint = ExtResource("29_wtdui")
[node name="CollisionShape3D" parent="YSorted/ScytheGenericPickup/PickupInteractionArea/Area2D" index="0"] [node name="SpawnWithItem" parent="YSorted/SeedPickup" index="0"]
shape = SubResource("CircleShape2D_lbnqo") _blueprint = ExtResource("35_64mdn")
[node name="ShovelGenericPickup" parent="YSorted" instance=ExtResource("25_hukxv")] [node name="CollisionShape3D" parent="YSorted/SeedPickup/PickupInteractionArea/Area2D" index="0"]
visible = false shape = SubResource("CircleShape2D_tm0yg")
position = Vector2(5454, 2049)
[node name="SpawnWithItem" parent="YSorted/ShovelGenericPickup" index="0"]
_blueprint = ExtResource("27_ipqaa")
[node name="CollisionShape3D" parent="YSorted/ShovelGenericPickup/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_l4wxt")
[node name="Farm visuals" type="Node2D" parent="YSorted"] [node name="Farm visuals" type="Node2D" parent="YSorted"]
position = Vector2(-60, 122) position = Vector2(-60, 122)
@ -2408,6 +2374,7 @@ timeline = "quest2_tomatoes_end"
[connection signal="InteractedTool" from="YSorted/Brünnen/InteractionArea" to="YSorted/Vesna" method="TryFillWateringCan"] [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/CanGenericPickup" to="YSorted/Vesna" method="HandlePickUp"]
[connection signal="SuccessfulPickUp" from="YSorted/RakeGenericPickup" 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="InteractedTool" from="YSorted/Farm visuals/Static/EnterHouseInteraction" to="." method="LoadSceneAtIndex"] [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="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="input_event" from="YSorted/Farm visuals/FieldParent/Area2D" to="YSorted/Vesna/FarmingControls" method="InputEventPressedOn"]
@ -2425,14 +2392,10 @@ timeline = "quest2_tomatoes_end"
[editable path="YSorted/Vesna"] [editable path="YSorted/Vesna"]
[editable path="YSorted/Brünnen/InteractionArea"] [editable path="YSorted/Brünnen/InteractionArea"]
[editable path="YSorted/HoeGenericPickup"]
[editable path="YSorted/HoeGenericPickup/PickupInteractionArea"]
[editable path="YSorted/CanGenericPickup"] [editable path="YSorted/CanGenericPickup"]
[editable path="YSorted/CanGenericPickup/PickupInteractionArea"] [editable path="YSorted/CanGenericPickup/PickupInteractionArea"]
[editable path="YSorted/RakeGenericPickup"] [editable path="YSorted/RakeGenericPickup"]
[editable path="YSorted/RakeGenericPickup/PickupInteractionArea"] [editable path="YSorted/RakeGenericPickup/PickupInteractionArea"]
[editable path="YSorted/ScytheGenericPickup"] [editable path="YSorted/SeedPickup"]
[editable path="YSorted/ScytheGenericPickup/PickupInteractionArea"] [editable path="YSorted/SeedPickup/PickupInteractionArea"]
[editable path="YSorted/ShovelGenericPickup"]
[editable path="YSorted/ShovelGenericPickup/PickupInteractionArea"]
[editable path="CanvasLayer"] [editable path="CanvasLayer"]

@ -165,4 +165,5 @@ public partial class FarmingControls2D : Node2D
} }
#endregion #endregion
} }

@ -1,5 +1,6 @@
using System; using System;
using Babushka.scripts.CSharp.Common.CharacterControls; using Babushka.scripts.CSharp.Common.CharacterControls;
using Babushka.scripts.CSharp.Common.Inventory;
using Godot; using Godot;
namespace Babushka.scripts.CSharp.Common.Farming; namespace Babushka.scripts.CSharp.Common.Farming;
@ -13,7 +14,9 @@ public partial class FieldBehaviour2D : Sprite2D
[Export] private Texture2D Tilled; [Export] private Texture2D Tilled;
[Export] private Texture2D Watered; [Export] private Texture2D Watered;
[Export] public FieldState FieldState = FieldState.Tilled; [Export] public FieldState FieldState = FieldState.Tilled;
[Export] private InteractionArea2D _growingCollider; [Export] public InteractionArea2D PlantingInteraction;
[Export] public Node PlantingPlaceholder;
public Vector2 FieldPosition; public Vector2 FieldPosition;
@ -31,19 +34,21 @@ public partial class FieldBehaviour2D : Sprite2D
{ {
case FieldState.Empty: case FieldState.Empty:
FieldState = FieldState.Empty; FieldState = FieldState.Empty;
PlantingInteraction.IsActive = false;
break; break;
case FieldState.Tilled: case FieldState.Tilled:
FieldState = FieldState.Tilled; FieldState = FieldState.Tilled;
_fieldSprite.Texture = Tilled; _fieldSprite.Texture = Tilled;
_growingCollider.Visible = false; PlantingInteraction.IsActive = false;
break; break;
case FieldState.Watered: case FieldState.Watered:
FieldState = FieldState.Watered; FieldState = FieldState.Watered;
_fieldSprite.Texture = Watered; _fieldSprite.Texture = Watered;
_growingCollider.Visible = true; PlantingInteraction.IsActive = true;
break; break;
case FieldState.Planted: case FieldState.Planted:
FieldState = FieldState.Planted; FieldState = FieldState.Planted;
PlantingInteraction.IsActive = false;
break; break;
default: default:
FieldState = FieldState.NotFound; FieldState = FieldState.NotFound;
@ -62,19 +67,37 @@ public partial class FieldBehaviour2D : Sprite2D
/// </summary> /// </summary>
public void Farm() public void Farm()
{ {
switch (FieldState) if (FieldState == FieldState.Watered)
{ {
case FieldState.Empty: if (TryPlant())
_fieldSprite.Texture = Tilled; {
FieldState = FieldState.Tilled; UpdateFieldState(FieldState.Planted);
break;
case FieldState.Watered:
FieldState = FieldState.Planted;
break;
case FieldState.Planted:
break;
default:
break;
} }
} }
}
private bool TryPlant()
{
bool success = false;
int currentSlotIndex = InventoryManager.Instance.CurrentSelectedSlotIndex;
ItemInstance? item = InventoryManager.Instance.playerInventory.Slots[currentSlotIndex].itemInstance;
if (item == null)
return success;
PackedScene? plantPrefab = SeedRepository.Instance.GetPlant(item.blueprint);
if (plantPrefab != null)
{
Node plantInstance = plantPrefab.Instantiate();
if (plantInstance is Node2D plant2d)
{
PlantingPlaceholder.AddChild(plant2d);
success = true;
}
}
return success;
}
} }

@ -12,20 +12,6 @@ public partial class FieldService2D : Node2D
[Signal] public delegate void FieldCreatedEventHandler(); [Signal] public delegate void FieldCreatedEventHandler();
/*
public override void _PhysicsProcess(double delta)
{
var spaceState = GetWorld2D().DirectSpaceState;
// use global coordinates, not local to node
var query = PhysicsRayQueryParameters2D.Create(GetGlobalMousePosition(), new Vector3(0,0,-1),
CollisionMask, [GetRid()]);
var result = spaceState.IntersectRay(query);
if (result.Count > 0)
GD.Print("Hit at point: ", result["position"]);
}
*/
//Create //Create
public bool TryAddEntry(Vector2I key, FieldBehaviour2D field) public bool TryAddEntry(Vector2I key, FieldBehaviour2D field)
{ {

@ -1,5 +1,4 @@
using System; using System;
using Babushka.scripts.CSharp.Common.CharacterControls;
using Babushka.scripts.CSharp.Common.Inventory; using Babushka.scripts.CSharp.Common.Inventory;
using Godot; using Godot;

@ -0,0 +1,29 @@
using Babushka.scripts.CSharp.Common.Inventory;
using Godot;
using Godot.Collections;
namespace Babushka.scripts.CSharp.Common.Farming;
public partial class SeedRepository : Node
{
public static SeedRepository Instance { get; private set; } = null!;
// todo: Find out how to not use PackedScene here because it does not inherit from Node
[Export] private Dictionary<ItemResource, PackedScene> seedToPlantRepository;
public override void _EnterTree()
{
Instance = this;
}
public PackedScene? GetPlant(ItemResource resource)
{
if (seedToPlantRepository.ContainsKey(resource))
{
return seedToPlantRepository[resource];
}
return null;
}
}
Loading…
Cancel
Save