Compare commits

...

3 Commits

22 changed files with 397 additions and 80 deletions
+9
View File
@@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="GdSdk" type="GdScript">
<CLASSES />
<JAVADOC />
<SOURCES>
<root url="file://$APPLICATION_PLUGINS_DIR$/GdScript/extracted/Master" />
</SOURCES>
</library>
</component>
-10
View File
@@ -1,10 +0,0 @@
<component name="libraryTable">
<library name="GdSdk Master" type="GdScript">
<properties path="$USER_HOME$/.cache/JetBrains/Rider2025.1/projects/.idea.babushka.a4de4632/sdk/GdSdk Master" version="Master" date="2024-06-01T15:14:16.000+02:00" />
<CLASSES />
<JAVADOC />
<SOURCES>
<root url="file://$USER_HOME$/.cache/JetBrains/Rider2025.1/projects/.idea.babushka.a4de4632/sdk/GdSdk Master" />
</SOURCES>
</library>
</component>
+28 -20
View File
@@ -32,23 +32,32 @@ radius = 325.2599
script = ExtResource("1_4mg73")
Payload = 0
[node name="FieldBehaviour" type="Sprite2D" parent="." node_paths=PackedStringArray("_fieldSprite", "_maskSprite", "_outlineSprite", "PlantingInteraction", "PlantingPlaceholder", "FieldInteractionArea", "_fieldIndex", "_wateringParticles")]
[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("_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")
_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")
FieldInteractionArea = NodePath("../InteractionArea")
_sceneKeyProvider = ExtResource("11_cjahb")
_fieldIndex = NodePath("..")
_wateringParticles = NodePath("../pouring water vfx")
_wateringEvent = ExtResource("14_57jmp")
@@ -62,16 +71,11 @@ texture = ExtResource("5_wx561")
[node name="PlantPlaceholder" type="Node2D" parent="FieldBehaviour"]
[node name="OutlineSprite" type="Sprite2D" parent="FieldBehaviour"]
self_modulate = Color(1, 1, 1, 0)
z_index = 1
scale = Vector2(1.5, 1.5)
texture = ExtResource("9_wx561")
[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("7_2eegd")]
position = Vector2(-26, -57)
[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
_spritesToOutline = [NodePath("../FieldBehaviour/OutlineSprite")]
_spritesToOutline = [NodePath("../../OutlineSprite")]
_showLabel = false
[node name="PlantCreationEventRaiser" type="Node" parent="."]
@@ -109,22 +113,26 @@ 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")]
[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" instance=ExtResource("7_2eegd")]
_useOutline = false
[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="InteractionArea" to="FieldBehaviour" method="Farm"]
[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/InteractionArea" method="ToggleActive"]
[connection signal="Interacted" from="FieldActivator/InteractionArea" to="FieldActivator" method="ActivateField"]
[connection signal="Interacted" from="FieldActivator/InteractionArea" to="FieldActivator/InteractionArea" method="ToggleActive"]
[editable path="FieldActivator/InteractionArea"]
+1
View File
@@ -13,6 +13,7 @@ resource_local_to_scene = true
radius = 300.0
[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")
+1
View File
@@ -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")
+1
View File
@@ -214,6 +214,7 @@ folder_colors={
"res://logos/": "blue",
"res://prefabs/": "purple",
"res://resources/": "purple",
"res://savegame/": "purple",
"res://scenes/": "purple",
"res://scripts/": "pink",
"res://shader/": "pink"
+37
View File
@@ -0,0 +1,37 @@
{
"beetRootScene_field0": "{\n\t\"field_state\": 1,\n\t\"plant_data\": {\n\t\t\"plant_days_growing\": 0,\n\t\t\"plant_state\": 3,\n\t\t\"prefab_path\": \"res://prefabs/farm/plants/beet_plant.tscn\"\n\t}\n}",
"beetRootScene_field1": "{\n\t\"field_state\": 1,\n\t\"plant_data\": {\n\t\t\"plant_days_growing\": 0,\n\t\t\"plant_state\": 3,\n\t\t\"prefab_path\": \"res://prefabs/farm/plants/beet_plant.tscn\"\n\t}\n}",
"beetRootScene_field2": "{\n\t\"field_state\": 1,\n\t\"plant_data\": {\n\t\t\"plant_days_growing\": 0,\n\t\t\"plant_state\": 3,\n\t\t\"prefab_path\": \"res://prefabs/farm/plants/beet_plant.tscn\"\n\t}\n}",
"beetRootScene_field3": "{\n\t\"field_state\": 1,\n\t\"plant_data\": {\n\t\t\"plant_days_growing\": 0,\n\t\t\"plant_state\": 3,\n\t\t\"prefab_path\": \"res://prefabs/farm/plants/beet_plant.tscn\"\n\t}\n}",
"beetRootScene_field4": "{\n\t\"field_state\": 1,\n\t\"plant_data\": {\n\t\t\"plant_days_growing\": 0,\n\t\t\"plant_state\": 3,\n\t\t\"prefab_path\": \"res://prefabs/farm/plants/beet_plant.tscn\"\n\t}\n}",
"beetRootScene_field5": "{\n\t\"field_state\": 1,\n\t\"plant_data\": {\n\t\t\"plant_days_growing\": 0,\n\t\t\"plant_state\": 2,\n\t\t\"prefab_path\": \"res://prefabs/farm/plants/beet_plant.tscn\"\n\t}\n}",
"beetRootScene_field6": "{\n\t\"field_state\": 1,\n\t\"plant_data\": {\n\t\t\"plant_days_growing\": 0,\n\t\t\"plant_state\": 3,\n\t\t\"prefab_path\": \"res://prefabs/farm/plants/beet_plant.tscn\"\n\t}\n}",
"beetRootScene_field7": "{\n\t\"field_state\": 1,\n\t\"plant_data\": {\n\t\t\"plant_days_growing\": 0,\n\t\t\"plant_state\": 3,\n\t\t\"prefab_path\": \"res://prefabs/farm/plants/beet_plant.tscn\"\n\t}\n}",
"beetRootScene_field8": "{\n\t\"field_state\": 0\n}",
"farmOutside_field0": "{\n\t\"field_state\": 0\n}",
"farmOutside_field1": "{\n\t\"field_state\": 0\n}",
"farmOutside_field10": "{\n\t\"field_state\": 0\n}",
"farmOutside_field11": "{\n\t\"field_state\": 0\n}",
"farmOutside_field12": "{\n\t\"field_state\": 0\n}",
"farmOutside_field13": "{\n\t\"field_state\": 0\n}",
"farmOutside_field14": "{\n\t\"field_state\": 0\n}",
"farmOutside_field15": "{\n\t\"field_state\": 0\n}",
"farmOutside_field16": "{\n\t\"field_state\": 0\n}",
"farmOutside_field17": "{\n\t\"field_state\": 0\n}",
"farmOutside_field18": "{\n\t\"field_state\": 0\n}",
"farmOutside_field19": "{\n\t\"field_state\": 0\n}",
"farmOutside_field2": "{\n\t\"field_state\": 0\n}",
"farmOutside_field20": "{\n\t\"field_state\": 0\n}",
"farmOutside_field21": "{\n\t\"field_state\": 0\n}",
"farmOutside_field22": "{\n\t\"field_state\": 0\n}",
"farmOutside_field23": "{\n\t\"field_state\": 0\n}",
"farmOutside_field24": "{\n\t\"field_state\": 0\n}",
"farmOutside_field25": "{\n\t\"field_state\": 0\n}",
"farmOutside_field3": "{\n\t\"field_state\": 0\n}",
"farmOutside_field4": "{\n\t\"field_state\": 0\n}",
"farmOutside_field5": "{\n\t\"field_state\": 0\n}",
"farmOutside_field6": "{\n\t\"field_state\": 0\n}",
"farmOutside_field7": "{\n\t\"field_state\": 0\n}",
"farmOutside_field8": "{\n\t\"field_state\": 0\n}",
"farmOutside_field9": "{\n\t\"field_state\": 0\n}"
}
+110 -2
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=115 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"]
@@ -77,6 +77,7 @@
[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")
@@ -1116,6 +1117,114 @@ 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)
@@ -2400,7 +2509,6 @@ _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/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"]
@@ -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"]
@@ -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"]
+49 -12
View File
@@ -246,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")
@@ -1750,10 +1750,16 @@ scale = Vector2(1, 0.993819)
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")
@@ -1762,10 +1768,16 @@ position = Vector2(1226, 3098.15)
scale = Vector2(1, 1.00622)
Payload = 1
[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 = 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")
@@ -1774,10 +1786,16 @@ position = Vector2(1782, 2606.11)
scale = Vector2(1, 1.00622)
Payload = 2
[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")
@@ -1786,13 +1804,17 @@ 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")
@@ -1801,13 +1823,17 @@ 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")
@@ -1816,13 +1842,17 @@ 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")
@@ -1831,13 +1861,17 @@ 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")
@@ -1846,13 +1880,17 @@ 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")
@@ -1861,13 +1899,11 @@ position = Vector2(5317, 3208.83)
scale = Vector2(1, 1.00622)
Payload = 8
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField9" index="0"]
visible = false
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")
@@ -1880,6 +1916,7 @@ _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"]
@@ -112,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;
}
@@ -1,27 +1,51 @@
using Babushka.scripts.CSharp.Common.CharacterControls;
using Godot;
namespace Babushka.scripts.CSharp.Common.Farming;
/// <summary>
/// Enables a preset field in the scene sothat it can be used for farming.
/// </summary>
public partial class FieldActivator : Node
{
[Export] private Node2D _field;
[Export] private FieldBehaviour2D _field;
[Export] private InteractionArea2D _activatorArea;
private bool _activated = false;
private bool _used = false;
private bool _rakeInHand;
public override void _Ready()
{
ToggleInteractionArea();
}
/// <summary>
/// Activates the fieldbehaviour node and sets it to the tilled state.
/// </summary>
public void ActivateField()
{
if (!_activated && _rakeInHand)
if (!_used && _rakeInHand)
{
GD.Print("Tryina activate this field right here....");
_field.Visible = true;
_activated = true;
_field.UpdateFieldState(FieldState.Tilled);
_used = true;
}
}
/// <summary>
/// Reacts to changes in the inventory.
/// If setup correctly, the field activator interactable should only trigger when using the rake.
/// </summary>
/// <param name="activated"></param>
public void RakeActivated(bool activated)
{
_rakeInHand = activated;
ToggleInteractionArea();
}
private void ToggleInteractionArea()
{
_activatorArea.IsActive = !_used && _rakeInHand;
}
}
@@ -1,15 +1,27 @@
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;
/// <summary>
/// Defines the behaviour of the field, i.e. interactions, states and effects.
/// </summary>
[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;
@@ -17,25 +29,25 @@ public partial class FieldBehaviour2D : Sprite2D
[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] public InteractionArea2D FieldInteractionArea;
[Export] public VariableResource _sceneKeyProvider;
[Export] private VariableNode _fieldIndex;
[Export] private CpuParticles2D _wateringParticles;
[Export] private EventResource _wateringEvent;
public Vector2 FieldPosition;
private bool _seedsActive;
private bool _wateringCanActive;
private bool _canPlant;
private bool _canWater;
private PlantBehaviour2D? _currentPlant;
[Signal] public delegate void PlantedEventHandler();
private void UpdateInteractionArea()
@@ -43,7 +55,7 @@ public partial class FieldBehaviour2D : Sprite2D
// fieldstate == tilled / watered && samen im Inventar
_canPlant = (FieldState == FieldState.Tilled || FieldState == FieldState.Watered) && _seedsActive;
// fieldstate == tilled && watering can ausgewählt
_canWater = FieldState == FieldState.Tilled && _wateringCanActive;
_canWater = (FieldState == FieldState.Tilled || FieldState == FieldState.Planted) && _wateringCanActive;
FieldInteractionArea.IsActive = _canPlant || _canWater;
}
@@ -58,11 +70,16 @@ public partial class FieldBehaviour2D : Sprite2D
_wateringCanActive = activated;
UpdateInteractionArea();
}
public override void _Ready()
{
if(PlantingPlaceholder.GetChildCount() > 0)
_currentPlant = PlantingPlaceholder.GetChild<PlantBehaviour2D>(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];
@@ -97,6 +114,7 @@ public partial class FieldBehaviour2D : Sprite2D
break;
}
UpdateInteractionArea();
UpdateSaveData();
}
@@ -116,7 +134,7 @@ public partial class FieldBehaviour2D : Sprite2D
/// </summary>
public void Farm()
{
if (_canPlant || TryPlant())
if (_canPlant && TryPlant())
{
EmitSignal(SignalName.Planted);
UpdateFieldState(FieldState.Planted);
@@ -133,31 +151,59 @@ 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<PackedScene>(prefabPath, nameof(PackedScene));
PackedScene prefab = ResourceLoader.Load<PackedScene>(plantPrefabPath, nameof(PackedScene));
Node2D plant2d = prefab.Instantiate<Node2D>();
PlantingPlaceholder.AddChild(plant2d);
plant2d.GlobalPosition = PlantingPlaceholder.GlobalPosition;
PlantBehaviour2D? plantBehaviour = plant2d as PlantBehaviour2D;
_currentPlant = plant2d as PlantBehaviour2D;
if (plantBehaviour != null)
if (_currentPlant != null)
{
plantBehaviour.Field = this;
_currentPlant.Field = this;
}
InventoryManager.Instance.playerInventory.RemoveItem(currentSlotIndex);
success = true;
}
return success;
}
}
public void UpdateSaveData()
{
var saveData = new SaveData();
saveData.SceneName = _sceneKeyProvider.Payload.AsString();
saveData.Id = SaveId + _fieldIndex.Payload.AsString();
var payloadData = new Dictionary<string, Variant>
{
{ "field_state", (int)FieldState }
};
if (_currentPlant != null)
{
payloadData.Add(
"plant_data", new Dictionary<string, Variant>()
{
{ "prefab_path", _currentPlant.PrefabPath },
{ "plant_state", (int)_currentPlant.State },
{ "plant_days_growing", _currentPlant.DaysGrowing }
}
);
}
saveData.JsonPayload = Json.Stringify(payloadData, indent: "\t");
SavegameService.AppendSave(saveData);
}
}
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Babushka.scripts.CSharp.Common.Services;
using Godot;
namespace Babushka.scripts.CSharp.Common.Farming;
@@ -24,7 +25,6 @@ public partial class FieldService : Node
//Create
public bool TryAddEntry(string sceneName, int fieldIndex, FieldBehaviour2D field)
{
GD.Print("Trying to add a field at: " + fieldIndex);
if (_outerDict != null )
{
FieldsInScene innerDict;
@@ -41,10 +41,6 @@ public partial class FieldService : Node
innerDict.fields.Add(fieldIndex, field);
return true;
}
else
{
GD.PrintErr("Duplicate field at: " + fieldIndex);
}
}
return false;
}
@@ -9,6 +9,7 @@ namespace Babushka.scripts.CSharp.Common.Farming;
/// </summary>
public partial class PlantBehaviour2D : Node2D
{
[Export] private string _prefabPath;
[Export] private Sprite2D[] _seeds;
[Export] private Sprite2D[] _smallPlants;
[Export] private Sprite2D[] _bigPlants;
@@ -24,6 +25,12 @@ public partial class PlantBehaviour2D : Node2D
private bool _magicWordSaid = false;
private bool _calledOnReady = false;
public PlantState State => _state;
public int DaysGrowing { get; set; }
public string PrefabPath => _prefabPath;
/// <summary>
/// public accessor for the field reference
/// </summary>
@@ -35,7 +42,6 @@ public partial class PlantBehaviour2D : Node2D
public override void _Ready()
{
GD.Print($"Ready: {Name}");
if (_state == PlantState.None)
{
_state = PlantState.Planted;
@@ -44,7 +50,6 @@ public partial class PlantBehaviour2D : Node2D
}
else
{
GD.Print("plant state not none.");
_calledOnReady = true;
GrowPlant();
}
@@ -67,7 +72,6 @@ public partial class PlantBehaviour2D : Node2D
return;
}
GD.Print("Growing plant.");
switch (_state)
{
case PlantState.None:
@@ -0,0 +1,16 @@
using System;
namespace Babushka.scripts.CSharp.Common.Savegame;
[Serializable]
public class SaveData
{
public string SceneName;
public string Id;
public string JsonPayload;
public string ToString()
{
return SceneName + " " + Id + " " + JsonPayload;
}
}
@@ -0,0 +1 @@
uid://bkftl5mj33eah
@@ -0,0 +1,34 @@
using Godot;
using Godot.Collections;
using FileAccess = Godot.FileAccess;
namespace Babushka.scripts.CSharp.Common.Savegame;
public static class SavegameService
{
public static readonly string SavePath = "res://savegame/savegame.json";
public static Dictionary<string, Variant> SaveDatas = new ();
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);
}
}
public static void Save()
{
string json = Json.Stringify(SaveDatas, indent: "\t");
using var file = FileAccess.Open(SavePath, FileAccess.ModeFlags.Write);
file.StoreString(json);
GD.Print($"Game saved to {file}");
}
}
@@ -0,0 +1 @@
uid://rm23q50boqe5
+3
View File
@@ -1,4 +1,6 @@
using Babushka.scripts.CSharp.Common.Savegame;
using Babushka.scripts.CSharp.Common.SceneManagement;
using Babushka.scripts.CSharp.Common.Services;
using Godot;
namespace Babushka.scripts.CSharp.Common;
@@ -16,6 +18,7 @@ public partial class SceneTransition : Node
public void LoadSceneAtIndex(int index)
{
SavegameService.Save();
string sceneName = _sceneNamesToLoad[index];
SceneTransitionThreaded.Instance.ChangeSceneToFileThreaded(sceneName);
UnloadAfterDelay();
@@ -2,6 +2,9 @@ using Godot;
namespace Babushka.scripts.CSharp.Low_Code.Variables;
/// <summary>
/// A Node type that carries a Variant payload.
/// </summary>
public partial class VariableNode : Node
{
[Export] public Variant Payload { get; set; }