feature/showcase_bugfixing_kathi_partII #16

Merged
Jonathan merged 33 commits from feature/showcase_bugfixing_kathi_partII into develop 2025-10-24 18:31:56 +02:00
9 changed files with 97 additions and 75 deletions
Showing only changes of commit d1a8ff0cbf - Show all commits
+1
View File
@@ -10,4 +10,5 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADictionary_00602_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003Fhome_003Fjonathan_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fe37dc1faf08a4d5ea030ad59bdf77522523400_003Fd4_003Fbd338aeb_003FDictionary_00602_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANode_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Ff1d69ec2da76ccf9bc8a75c8e0fdca9a7ba1adf8c8c9d5047e2fa5991c02eca_003FNode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AResourceLoader_002Ecs_002Fl_003AC_0021_003FUsers_003FJonathan_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F9f4e8eb124d11f8219cb513a19bed22b2120ed29f9d6785ba56e3367b48d581_003FResourceLoader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AResourceLoader_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F9f4e8eb124d11f8219cb513a19bed22b2120ed29f9d6785ba56e3367b48d581_003FResourceLoader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003AC_0021_003FUsers_003FJonathan_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fc7102cd0ffb8973777e61b1942c3fffac7e14016a511d055c3adf73ff91748_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
+3 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=3 uid="uid://b1d2e7ely6hyw"]
[gd_scene load_steps=9 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"]
@@ -7,6 +7,7 @@
[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"]
[node name="BaseField" type="Node2D"]
@@ -21,6 +22,7 @@ Tilled = ExtResource("5_wx561")
Watered = ExtResource("6_7m4xq")
PlantingInteraction = NodePath("../InteractionArea")
PlantingPlaceholder = NodePath("PlantPlaceholder")
ItemRepository = ExtResource("7_w8caw")
[node name="MaskedField" type="Sprite2D" parent="FieldBehaviour"]
clip_children = 1
+1 -5
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=3 uid="uid://gishbn0a8eke"]
[gd_scene load_steps=12 format=3 uid="uid://gishbn0a8eke"]
[ext_resource type="Script" uid="uid://cms357f23fmfy" path="res://scripts/CSharp/Common/Farming/PlantBehaviour2D.cs" id="1_66p1c"]
[ext_resource type="Texture2D" uid="uid://dtr4uga5uspg" path="res://art/farm/farming/farmobjekte/tomaten/tomaten baby.png" id="2_vjw4j"]
@@ -6,7 +6,6 @@
[ext_resource type="Texture2D" uid="uid://b2gu6ur2xc7s4" path="res://art/farm/farming/farmobjekte/tomaten/tomaten blume.png" id="4_hmj2d"]
[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="5_3j24b"]
[ext_resource type="PackedScene" uid="uid://dpbbroif2tnil" path="res://prefabs/interactions/generic_item_on_ground_2d.tscn" id="6_gdrin"]
[ext_resource type="Resource" uid="uid://blr8tine5m0ma" path="res://resources/items/tomato.tres" id="7_di4m0"]
[ext_resource type="Texture2D" uid="uid://cnwd3mb3jnuxm" path="res://art/farm/farming/farmobjekte/tomaten/teen adulte tomaten.png" id="8_evgr8"]
[ext_resource type="Texture2D" uid="uid://bleimj6jr1jka" path="res://art/general/rectangle.png" id="9_vjw4j"]
@@ -151,9 +150,6 @@ shape = SubResource("CircleShape2D_vjw4j")
position = Vector2(0, 2.3)
IsActive = false
[node name="SpawnWithItem" parent="ReadyPlantInventoryItem" index="0"]
_blueprint = ExtResource("7_di4m0")
[node name="ItemLabel" parent="ReadyPlantInventoryItem" index="1"]
visible = false
z_index = 100
+1
View File
@@ -146,6 +146,7 @@ directories/tres_directory={
"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",
"itemRepository": "res://resources/itemRepository.tres",
"preview_character": "res://addons/dialogic/Modules/Character/preview_character.tres",
"rake": "res://resources/items/rake.tres",
"scythe": "res://resources/items/scythe.tres",
@@ -1,4 +1,4 @@
[gd_scene load_steps=41 format=3 uid="uid://bm21nqepnwaik"]
[gd_scene load_steps=40 format=3 uid="uid://bm21nqepnwaik"]
[ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_3vr4f"]
[ext_resource type="Texture2D" uid="uid://cnhsxxps2cw5" path="res://art/indoor/room export/Room_01_table.png" id="2_ubg3a"]
@@ -7,7 +7,6 @@
[ext_resource type="Texture2D" uid="uid://waqmjrxduxfq" path="res://art/indoor/room export/Room_01_walls.png" id="5_sndxu"]
[ext_resource type="Texture2D" uid="uid://bqwhptcgg5ons" path="res://art/indoor/room export/Room_01_dorr_R.png" id="6_blyw3"]
[ext_resource type="Texture2D" uid="uid://vyk63d0pgqm5" path="res://art/indoor/room export/Room_01_dioor L.png" id="7_yd2gv"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/simple_interactable_outline.tres" id="8_7a68a"]
[ext_resource type="Texture2D" uid="uid://b2rj7wkyu6ehy" path="res://art/indoor/room export/Room_01_pechka.png" id="8_ofqcg"]
[ext_resource type="Texture2D" uid="uid://dhvi5404cqioa" path="res://art/indoor/room export/Room_01_window.png" id="9_aoesu"]
[ext_resource type="Texture2D" uid="uid://bpi35nxbhput8" path="res://art/indoor/room export/Room_01_pechkaDoor.png" id="10_xcryd"]
@@ -312,7 +311,6 @@ region_rect = Rect2(3161, 313, 679, 1050)
[node name="OutsideDoor" parent="BackWall/Room01DorrR" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("11_gpagp")]
position = Vector2(-7, 248)
_outlineMaterial = ExtResource("8_7a68a")
_spriteToOutline = NodePath("..")
_id = 1
@@ -325,7 +323,6 @@ region_rect = Rect2(0, 0, 3840, 2160)
[node name="VesnasRoomDoor" parent="BackWall/Room01DoorL" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("11_gpagp")]
position = Vector2(-1559, -16)
_outlineMaterial = ExtResource("8_7a68a")
_spriteToOutline = NodePath("..")
_id = 0
@@ -362,7 +359,6 @@ region_rect = Rect2(2360, 864, 356, 251)
[node name="InteractionArea" parent="BackWall/Room01PechkaDoor" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("11_gpagp")]
scale = Vector2(1.8, 1.96)
_outlineMaterial = ExtResource("8_7a68a")
_spriteToOutline = NodePath("..")
[node name="CollisionShape3D" parent="BackWall/Room01PechkaDoor/InteractionArea/Area2D" index="0"]
@@ -413,7 +409,6 @@ script = ExtResource("22_tggq2")
[node name="InteractionArea" parent="BackWall/Katze" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("11_gpagp")]
position = Vector2(-6.5, -44)
scale = Vector2(0.5, 0.5)
_outlineMaterial = ExtResource("8_7a68a")
_spriteToOutline = NodePath("..")
[node name="Room assets" type="Node" parent="BackWall"]
+46 -45
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=91 format=3 uid="uid://b3ibx4resa1f3"]
[gd_scene load_steps=92 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"]
@@ -137,11 +137,15 @@ size = Vector2(1041, 368)
resource_local_to_scene = true
radius = 371.058
[sub_resource type="CircleShape2D" id="CircleShape2D_2nee2"]
[sub_resource type="CircleShape2D" id="CircleShape2D_dr6bm"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_ipqaa"]
[sub_resource type="CircleShape2D" id="CircleShape2D_34r5t"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_hpgl7"]
resource_local_to_scene = true
radius = 300.0
@@ -173,27 +177,27 @@ shader_parameter/offset = 0.0
shader = ExtResource("24_anpd4")
shader_parameter/tiling_scale = Vector2(1, 20)
[sub_resource type="CircleShape2D" id="CircleShape2D_hpgl7"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_qavgq"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_dr6bm"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_njxly"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_34r5t"]
[sub_resource type="CircleShape2D" id="CircleShape2D_54ty3"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_54ty3"]
[sub_resource type="CircleShape2D" id="CircleShape2D_gbxtf"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_6krrk"]
resource_local_to_scene = true
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_4ktoi"]
resource_local_to_scene = true
radius = 300.0
@@ -947,7 +951,6 @@ z_index = 1
position = Vector2(2693, 1876)
_fieldParent = NodePath("../Farm visuals/FieldParent")
_hoe = ExtResource("28_le48k")
_wateringCan = ExtResource("29_6laxt")
[node name="Animated Sprites" parent="YSorted/Vesna/CharacterBody2D/visuals" index="0"]
position = Vector2(-33, 554)
@@ -987,8 +990,8 @@ position = Vector2(6095, 2087)
[node name="SpawnWithItem" parent="YSorted/HoeGenericPickup" index="0"]
_blueprint = ExtResource("33_v0fwx")
[node name="CollisionShape3D" parent="YSorted/HoeGenericPickup/InteractionArea2/Area2D" index="0"]
shape = SubResource("CircleShape2D_2nee2")
[node name="CollisionShape3D" parent="YSorted/HoeGenericPickup/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_dr6bm")
[node name="CanGenericPickup" parent="YSorted" instance=ExtResource("32_752hh")]
visible = false
@@ -997,11 +1000,8 @@ position = Vector2(8192, 3507)
[node name="SpawnWithItem" parent="YSorted/CanGenericPickup" index="0"]
_blueprint = ExtResource("29_6laxt")
[node name="InteractionArea2" parent="YSorted/CanGenericPickup" index="3"]
position = Vector2(0, -159)
[node name="CollisionShape3D" parent="YSorted/CanGenericPickup/InteractionArea2/Area2D" index="0"]
shape = SubResource("CircleShape2D_ipqaa")
[node name="CollisionShape3D" parent="YSorted/CanGenericPickup/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_34r5t")
[node name="RakeGenericPickup" parent="YSorted" instance=ExtResource("32_752hh")]
visible = false
@@ -1010,8 +1010,8 @@ position = Vector2(8391, 2060)
[node name="SpawnWithItem" parent="YSorted/RakeGenericPickup" index="0"]
_blueprint = ExtResource("28_le48k")
[node name="CollisionShape3D" parent="YSorted/RakeGenericPickup/InteractionArea2/Area2D" index="0"]
shape = SubResource("CircleShape2D_ipqaa")
[node name="CollisionShape3D" parent="YSorted/RakeGenericPickup/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_hpgl7")
[node name="Farm visuals" type="Node2D" parent="YSorted"]
position = Vector2(-60, 122)
@@ -1751,10 +1751,11 @@ rotation = 1.5708
scale = Vector2(0.1, 8.7)
texture = ExtResource("26_bwvai")
[node name="FieldParent" type="Node2D" parent="YSorted/Farm visuals"]
[node name="FieldParent" type="Node2D" parent="YSorted/Farm visuals" node_paths=PackedStringArray("fields")]
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" instance=ExtResource("43_dr6bm")]
@@ -1769,8 +1770,8 @@ visible = true
[node name="01" parent="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot/BigPlant" index="0"]
visible = false
[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/InteractionArea2/Area2D" index="0"]
shape = SubResource("CircleShape2D_hpgl7")
[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_qavgq")
[node name="BaseField2" parent="YSorted/Farm visuals" instance=ExtResource("43_dr6bm")]
position = Vector2(1230, 2590)
@@ -1784,8 +1785,8 @@ visible = false
[node name="03" parent="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot/BigPlant" index="2"]
visible = true
[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/InteractionArea2/Area2D" index="0"]
shape = SubResource("CircleShape2D_qavgq")
[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_njxly")
[node name="BaseField3" parent="YSorted/Farm visuals" instance=ExtResource("43_dr6bm")]
position = Vector2(1994, 2603)
@@ -1799,8 +1800,8 @@ visible = true
[node name="01" parent="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot/BigPlant" index="0"]
visible = false
[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/InteractionArea2/Area2D" index="0"]
shape = SubResource("CircleShape2D_dr6bm")
[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_54ty3")
[node name="BaseField4" parent="YSorted/Farm visuals" instance=ExtResource("43_dr6bm")]
position = Vector2(478, 3098)
@@ -1814,8 +1815,8 @@ visible = true
[node name="01" parent="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot/BigPlant" index="0"]
visible = false
[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/InteractionArea2/Area2D" index="0"]
shape = SubResource("CircleShape2D_njxly")
[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_gbxtf")
[node name="BaseField5" parent="YSorted/Farm visuals" instance=ExtResource("43_dr6bm")]
position = Vector2(1279, 3123)
@@ -1832,8 +1833,8 @@ visible = false
[node name="02" parent="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot/BigPlant" index="1"]
visible = true
[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/InteractionArea2/Area2D" index="0"]
shape = SubResource("CircleShape2D_34r5t")
[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_6krrk")
[node name="BaseField6" parent="YSorted/Farm visuals" instance=ExtResource("43_dr6bm")]
position = Vector2(2037, 3135)
@@ -1847,8 +1848,8 @@ visible = true
[node name="01" parent="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot/BigPlant" index="0"]
visible = false
[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/InteractionArea2/Area2D" index="0"]
shape = SubResource("CircleShape2D_54ty3")
[node name="CollisionShape3D" parent="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_4ktoi")
[node name="Blocker" type="Node2D" parent="YSorted"]
@@ -1958,33 +1959,33 @@ script = ExtResource("58_m3hs4")
[editable path="YSorted/Vesna"]
[editable path="YSorted/Brünnen/InteractionArea"]
[editable path="YSorted/HoeGenericPickup"]
[editable path="YSorted/HoeGenericPickup/InteractionArea2"]
[editable path="YSorted/HoeGenericPickup/PickupInteractionArea"]
[editable path="YSorted/CanGenericPickup"]
[editable path="YSorted/CanGenericPickup/InteractionArea2"]
[editable path="YSorted/CanGenericPickup/PickupInteractionArea"]
[editable path="YSorted/RakeGenericPickup"]
[editable path="YSorted/RakeGenericPickup/InteractionArea2"]
[editable path="YSorted/RakeGenericPickup/PickupInteractionArea"]
[editable path="YSorted/Farm visuals/BaseField"]
[editable path="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot"]
[editable path="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem"]
[editable path="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/InteractionArea2"]
[editable path="YSorted/Farm visuals/BaseField/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea"]
[editable path="YSorted/Farm visuals/BaseField2"]
[editable path="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot"]
[editable path="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem"]
[editable path="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/InteractionArea2"]
[editable path="YSorted/Farm visuals/BaseField2/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea"]
[editable path="YSorted/Farm visuals/BaseField3"]
[editable path="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot"]
[editable path="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem"]
[editable path="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/InteractionArea2"]
[editable path="YSorted/Farm visuals/BaseField3/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea"]
[editable path="YSorted/Farm visuals/BaseField4"]
[editable path="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot"]
[editable path="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem"]
[editable path="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/InteractionArea2"]
[editable path="YSorted/Farm visuals/BaseField4/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea"]
[editable path="YSorted/Farm visuals/BaseField5"]
[editable path="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot"]
[editable path="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem"]
[editable path="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/InteractionArea2"]
[editable path="YSorted/Farm visuals/BaseField5/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea"]
[editable path="YSorted/Farm visuals/BaseField6"]
[editable path="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot"]
[editable path="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem"]
[editable path="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/InteractionArea2"]
[editable path="YSorted/Farm visuals/BaseField6/FieldBehaviour/BeetRoot/ReadyPlantInventoryItem/PickupInteractionArea"]
[editable path="CanvasLayer"]
@@ -16,6 +16,7 @@ public partial class FieldBehaviour2D : Sprite2D
[Export] public FieldState FieldState = FieldState.Tilled;
[Export] public InteractionArea2D PlantingInteraction;
[Export] public Node2D PlantingPlaceholder;
[Export] public ItemRepository ItemRepository;
public Vector2 FieldPosition;
@@ -83,24 +84,25 @@ public partial class FieldBehaviour2D : Sprite2D
if (item == null || PlantingPlaceholder.GetChildCount() > 0)
return success;
PackedScene? plantPrefab = item.blueprint.itemPrefab;
string prefabPath = ItemRepository.TryGetPrefabPath(item.blueprint);
if (plantPrefab != null)
if (prefabPath != null)
{
Node plantInstance = plantPrefab.Instantiate();
if (plantInstance is Node2D plant2d)
{
PlantingPlaceholder.AddChild(plant2d);
plant2d.GlobalPosition = PlantingPlaceholder.GlobalPosition;
PlantBehaviour2D? plantBehaviour = plant2d as PlantBehaviour2D;
if (plantBehaviour != null)
{
plantBehaviour.Field = this;
}
success = true;
// todo: Error: cannot convert value at key from string to object
PackedScene prefab = ResourceLoader.Load<PackedScene>(prefabPath, nameof(PackedScene));
Node2D plant2d = prefab.Instantiate<Node2D>();
PlantingPlaceholder.AddChild(plant2d);
plant2d.GlobalPosition = PlantingPlaceholder.GlobalPosition;
PlantBehaviour2D? plantBehaviour = plant2d as PlantBehaviour2D;
if (plantBehaviour != null)
{
plantBehaviour.Field = this;
}
success = true;
}
return success;
@@ -0,0 +1,28 @@
using Godot;
using Godot.Collections;
namespace Babushka.scripts.CSharp.Common.Inventory;
/// <summary>
/// A dictionary wrapper resource that holds references to ItemResources and maps them to their respective prefabs.
/// </summary>
[GlobalClass]
public partial class ItemRepository : Resource
{
[Export] public Dictionary<ItemResource, string> itemInventoryRepository;
/// <summary>
/// Returns the path to the itemPrefab for the inventory item.
/// </summary>
/// <param name="resource"></param>
/// <returns></returns>
public string TryGetPrefabPath(ItemResource resource)
{
if (itemInventoryRepository.Keys.Contains(resource))
{
return itemInventoryRepository[resource];
}
return null;
}
}
@@ -17,15 +17,11 @@ public partial class ItemResource : Resource
[Export]
public int maxStack;
[Export]
public PackedScene? itemPrefab;
public ItemResource()
Outdated
Review

Ich musste im Code nachschauen, um zu verstehen, wofür das überhaupt ist. Ich denke, das braucht mindestens einen anderen Namen.
Besser aber noch, das kommt in eine neue Klasse oder eine abgeleitete Klasse (z. B. PlantableItemResource)

Außerdem habe ich Angst, da hier ne PackedScene referenziert wird, dass wir wieder irgendwann in ein cyclic dependency problem geraten, das super schwer zu debuggen ist.

Ich musste im Code nachschauen, um zu verstehen, wofür das überhaupt ist. Ich denke, das braucht mindestens einen anderen Namen. Besser aber noch, das kommt in eine neue Klasse oder eine abgeleitete Klasse (z. B. `PlantableItemResource`) Außerdem habe ich Angst, da hier ne PackedScene referenziert wird, dass wir wieder irgendwann in ein cyclic dependency problem geraten, das super schwer zu debuggen ist.
Outdated
Review

Ich habe noch einmal darüber nachgedacht und bin mir sehr sicher, dass wir damit in eine cyclic dependency geraten, sobald eine Tomatenpflanze nicht nur Tomaten, sondern auch selbst wieder Samen droped. Selbst wenn das Gamedesign technisch nicht vorgesehen ist, schaffen wir uns hier einen ganz gefährlichen Sonderfall.

Wir sollten stattdessen lieber eine Lookup-Table-Resource haben. Darin ist ein Array aus Paaren von ItemResource und PackedScene. Die FieldBehaviour Klasse kann sich basierend auf dem Item das richtige Prefab für die Pflanze raus suchen

Ich habe noch einmal darüber nachgedacht und bin mir sehr sicher, dass wir damit in eine cyclic dependency geraten, sobald eine Tomatenpflanze nicht nur Tomaten, sondern auch selbst wieder Samen droped. Selbst wenn das Gamedesign technisch nicht vorgesehen ist, schaffen wir uns hier einen ganz gefährlichen Sonderfall. Wir sollten stattdessen lieber eine Lookup-Table-Resource haben. Darin ist ein Array aus Paaren von ItemResource und PackedScene. Die FieldBehaviour Klasse kann sich basierend auf dem Item das richtige Prefab für die Pflanze raus suchen
Outdated
Review

Lass mal bei Gelegenheit darüber callen.

Ich bin mir fast sicher, dass deine Bedenken hier unbegründet sind. Der Lösungsvorschlag mit der Lookup-Tabelle ließe sich zwar auch umsetzen, allerdings nicht mit ItemResources als Keys, weil diese nicht von Godot serialisiert werden können und damit in Godot Dictionaries Fehler werfen.

Man kann das umgehen, indem man strings oder enums als identifier benutzt und dazwischenschaltet, das ist aber im Verhältnis zu dieser Lösung sehr viel komplexer und meiner Meinung nach nicht notwendig, da wir ja nicht auf Instanzen direkt zugreifen, sondern nur auf Prefabs / Resourcen verweisen.

Lass mal bei Gelegenheit darüber callen. Ich bin mir fast sicher, dass deine Bedenken hier unbegründet sind. Der Lösungsvorschlag mit der Lookup-Tabelle ließe sich zwar auch umsetzen, allerdings nicht mit ItemResources als Keys, weil diese nicht von Godot serialisiert werden können und damit in Godot Dictionaries Fehler werfen. Man kann das umgehen, indem man strings oder enums als identifier benutzt und dazwischenschaltet, das ist aber im Verhältnis zu dieser Lösung sehr viel komplexer und meiner Meinung nach nicht notwendig, da wir ja nicht auf Instanzen direkt zugreifen, sondern nur auf Prefabs / Resourcen verweisen.
{
name = "";
color = Colors.Red;
maxStack = 1;
itemPrefab = null;
}
}