Compare commits

...

6 Commits

20 changed files with 329 additions and 188 deletions
+11 -31
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=486 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"]
@@ -285,7 +285,6 @@
[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"]
@@ -294,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"]
@@ -480,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"]
@@ -2086,7 +2085,6 @@ stream_6/stream = ExtResource("476_deeju")
[node name="Vesna" type="Node2D" node_paths=PackedStringArray("_farmingControls", "_player2d", "_vesnaAnimations")]
y_sort_enabled = true
position = Vector2(0, 2)
script = ExtResource("1_yd5ep")
_farmingControls = NodePath("FarmingControls")
_player2d = NodePath("CharacterBody2D")
@@ -2108,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")]
[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)
@@ -2155,33 +2152,12 @@ _eventResources = Array[Object]([ExtResource("468_t1d6r")])
script = ExtResource("467_8hbu5")
_eventResources = Array[Object]([ExtResource("469_t1d6r")])
[node name="FarmingControls" type="Node2D" parent="." node_paths=PackedStringArray("_movingPlayer", "_wateringParticles")]
[node name="FarmingControls" type="Node2D" parent="." node_paths=PackedStringArray("_movingPlayer")]
script = ExtResource("817_6nrw3")
_sceneKeyProvider = ExtResource("471_83c4i")
_fieldPrefab = ExtResource("818_16w6h")
_movingPlayer = NodePath("../CharacterBody2D")
_wateringParticles = NodePath("../pouring water vfx")
_wateringCanParticlesVerticalOffset = -100.0
_fieldOffsetVector = Vector2i(735, 680)
[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)
@@ -2198,6 +2174,10 @@ 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"]
@@ -2205,7 +2185,7 @@ wait_time = 0.5
[connection signal="LookDirection" from="CharacterBody2D/visuals" to="CharacterBody2D/DetectionCross" method="SetDirection"]
[connection signal="EventRaised" from="CharacterBody2D/PlantCreatedEventListener" to="CharacterBody2D/visuals" method="PlayFarmingAnimation"]
[connection signal="EventRaised" from="CharacterBody2D/PickedUpInteractableListener" to="CharacterBody2D/visuals" method="PlayPickUpAnimation"]
[connection signal="WateringField" from="FarmingControls" to="CharacterBody2D/visuals" method="PlayWateringAnimation"]
[connection signal="WateringField" from="FarmingControls" to="CharacterBody2D/WateringCanUI" method="Water"]
[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"]
+57 -2
View File
@@ -1,5 +1,6 @@
[gd_scene load_steps=18 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"]
@@ -13,14 +14,25 @@
[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="FieldBehaviour" type="Sprite2D" parent="." node_paths=PackedStringArray("_fieldSprite", "_maskSprite", "_outlineSprite", "PlantingInteraction", "PlantingPlaceholder", "FieldInteractionArea")]
[node name="FieldBehaviour" type="Sprite2D" parent="." node_paths=PackedStringArray("_fieldSprite", "_maskSprite", "_outlineSprite", "PlantingInteraction", "PlantingPlaceholder", "FieldInteractionArea", "_fieldIndex", "_wateringParticles")]
z_index = -1
scale = Vector2(0.9, 1)
script = ExtResource("1_qa01x")
@@ -35,6 +47,10 @@ PlantingInteraction = 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")
[node name="MaskedField" type="Sprite2D" parent="FieldBehaviour"]
clip_children = 1
@@ -56,6 +72,7 @@ texture = ExtResource("9_wx561")
position = Vector2(-26, -57)
_active = false
_spritesToOutline = [NodePath("../FieldBehaviour/OutlineSprite")]
_showLabel = false
[node name="PlantCreationEventRaiser" type="Node" parent="."]
script = ExtResource("9_teirr")
@@ -69,7 +86,45 @@ _itemResourcesToListenFor = Array[Object]([ExtResource("15_i4qwg"), ExtResource(
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")]
script = ExtResource("22_57jmp")
_field = NodePath("../FieldBehaviour")
[node name="InteractionArea" parent="FieldActivator" instance=ExtResource("7_2eegd")]
_useOutline = false
[node name="CollisionShape3D" parent="FieldActivator/InteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_57jmp")
[connection signal="Planted" from="FieldBehaviour" to="PlantCreationEventRaiser" method="RaiseEvents"]
[connection signal="Interacted" from="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"]
[editable path="FieldActivator/InteractionArea"]
+1 -1
View File
@@ -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")]
+1 -1
View File
@@ -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
+2
View File
@@ -149,6 +149,7 @@ directories/tres_directory={
"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",
@@ -174,6 +175,7 @@ directories/tres_directory={
"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",
@@ -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"
@@ -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"
+16 -27
View File
@@ -73,8 +73,10 @@
[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"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_wtdui"]
shader = ExtResource("13_7p0hq")
@@ -209,13 +211,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_p6n74"]
resource_local_to_scene = true
size = Vector2(7150, 1192)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2nee2"]
size = Vector2(5782, 1176)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_lwk6t"]
shader = ExtResource("13_7p0hq")
shader_parameter/hue_shift = 0.0
@@ -602,7 +597,7 @@ texture = ExtResource("13_0qu0h")
[node name="JelenaMockupBg03" type="Sprite2D" parent="ParallaxBackground/background layer 4"]
z_index = -200
material = SubResource("ShaderMaterial_wtdui")
position = Vector2(7923, 727)
position = Vector2(7893.0005, 727)
scale = Vector2(2.75, 2.75)
texture = ExtResource("13_0qu0h")
@@ -1039,8 +1034,9 @@ z_index = 1
position = Vector2(9322, 2018)
_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="Well" type="Sprite2D" parent="YSorted" node_paths=PackedStringArray("_interactionArea")]
z_index = 1
@@ -1117,6 +1113,9 @@ 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="Farm visuals" type="Node2D" parent="YSorted"]
position = Vector2(-60, 122)
@@ -2093,22 +2092,6 @@ rotation = 1.5708
scale = Vector2(0.1, 10.8)
texture = ExtResource("21_if5vh")
[node name="Area2D" type="Area2D" parent="YSorted/Farm visuals"]
position = Vector2(5, 4.098892)
scale = Vector2(1, 0.993819)
collision_mask = 5
collision_priority = 10.0
[node name="CollisionShape2D2" type="CollisionShape2D" parent="YSorted/Farm visuals/Area2D"]
position = Vector2(11913.999, 2960)
scale = Vector2(0.99999994, 0.99999994)
shape = SubResource("RectangleShape2D_p6n74")
[node name="CollisionShape2D" type="CollisionShape2D" parent="YSorted/Farm visuals/Area2D"]
position = Vector2(2895.9998, 2949)
scale = Vector2(0.99999994, 0.99999994)
shape = SubResource("RectangleShape2D_2nee2")
[node name="Blocker" type="Node2D" parent="YSorted"]
[node name="Fence Door2" type="Sprite2D" parent="YSorted/Blocker"]
@@ -2150,6 +2133,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")
@@ -2226,6 +2210,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
@@ -2409,6 +2394,11 @@ _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/Well/InteractionArea" to="YSorted/Vesna" method="TryFillWateringCan"]
@@ -2417,8 +2407,6 @@ timeline = "quest2_tomatoes_end"
[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="mouse_entered" from="YSorted/Farm visuals/Area2D" to="YSorted/Vesna/FarmingControls" method="CanCreateFields"]
[connection signal="mouse_exited" from="YSorted/Farm visuals/Area2D" to="YSorted/Vesna/FarmingControls" method="CannotCreateFields"]
[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"]
@@ -2431,6 +2419,7 @@ 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/Well/InteractionArea"]
+102 -34
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=86 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"]
@@ -41,16 +41,16 @@
[ext_resource type="Texture2D" uid="uid://badnnid7dgnpk" path="res://art/nature/grass/grass-4.png" id="42_7jeth"]
[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="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/simple_interactable_outline.tres" id="44_34r5t"]
[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"]
@@ -170,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
@@ -185,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
@@ -958,6 +998,7 @@ shape = SubResource("RectangleShape2D_0sfl7")
[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"]
position = Vector2(146, -130)
@@ -1701,12 +1742,9 @@ 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)
@@ -1716,40 +1754,37 @@ scale = Vector2(1, 1.00622)
_state = 2
_field = NodePath("../..")
[node name="InteractionArea" parent="YSorted/Farm visuals/FieldParent/BaseField" index="1"]
_outlineMaterial = ExtResource("44_34r5t")
[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)
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField2" index="0"]
FieldState = 3
Payload = 1
[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="InteractionArea" parent="YSorted/Farm visuals/FieldParent/BaseField2" index="1"]
_outlineMaterial = ExtResource("44_34r5t")
[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)
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField3" index="0"]
FieldState = 3
Payload = 2
[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="InteractionArea" parent="YSorted/Farm visuals/FieldParent/BaseField3" index="1"]
_outlineMaterial = ExtResource("44_34r5t")
[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"]
FieldState = 3
@@ -1758,12 +1793,13 @@ FieldState = 3
_state = 2
_field = NodePath("../..")
[node name="InteractionArea" parent="YSorted/Farm visuals/FieldParent/BaseField4" index="1"]
_outlineMaterial = ExtResource("44_34r5t")
[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"]
FieldState = 3
@@ -1772,12 +1808,13 @@ FieldState = 3
_state = 2
_field = NodePath("../..")
[node name="InteractionArea" parent="YSorted/Farm visuals/FieldParent/BaseField5" index="1"]
_outlineMaterial = ExtResource("44_34r5t")
[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"]
FieldState = 3
@@ -1786,12 +1823,13 @@ FieldState = 3
_state = 1
_field = NodePath("../..")
[node name="InteractionArea" parent="YSorted/Farm visuals/FieldParent/BaseField6" index="1"]
_outlineMaterial = ExtResource("44_34r5t")
[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"]
FieldState = 3
@@ -1800,12 +1838,13 @@ FieldState = 3
_state = 2
_field = NodePath("../..")
[node name="InteractionArea" parent="YSorted/Farm visuals/FieldParent/BaseField7" index="1"]
_outlineMaterial = ExtResource("44_34r5t")
[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"]
FieldState = 3
@@ -1814,22 +1853,24 @@ FieldState = 3
_state = 2
_field = NodePath("../..")
[node name="InteractionArea" parent="YSorted/Farm visuals/FieldParent/BaseField8" index="1"]
_outlineMaterial = ExtResource("44_34r5t")
[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"]
visible = false
FieldState = 3
[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="InteractionArea" parent="YSorted/Farm visuals/FieldParent/BaseField9" index="1"]
_outlineMaterial = ExtResource("44_34r5t")
[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"]
@@ -1874,6 +1915,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"]
@@ -1936,25 +1989,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"]
@@ -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;
}
@@ -9,18 +9,15 @@ namespace Babushka.scripts.CSharp.Common.Farming;
public partial class FarmingControls2D : Node2D
{
[Export] private VariableResource _sceneKeyProvider;
[Export] private PackedScene? _fieldPrefab = null!;
[Export] private Node2D _movingPlayer;
[Export] private Camera2D _camera;
[Export] private CpuParticles2D _wateringParticles;
[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;
private bool _canCreateFields = false;
[Signal] public delegate void WateringFieldEventHandler();
[Signal] public delegate void FieldCreatedEventHandler();
@@ -58,14 +55,7 @@ public partial class FarmingControls2D : Node2D
{
if (@event.IsActionPressed("click"))
{
if (_toolId == WateringCanState.WATERING_CAN_ID
&& WateringCanState.GetFillState() > 0)
{
Vector2I adjustedPosition = GetAdjustedMousePosition();
WaterTheField(adjustedPosition);
}
if (_canCreateFields && _toolId == 0)
if ( _toolId == 0)
{
Vector2I adjustedPosition = GetAdjustedMousePosition();
MakeField(adjustedPosition);
@@ -85,16 +75,6 @@ public partial class FarmingControls2D : Node2D
{
return input.Snapped(step);
}
public void CanCreateFields()
{
_canCreateFields = true;
}
public void CannotCreateFields()
{
_canCreateFields = false;
}
#region WATERING
public void FillWateringCan()
@@ -104,52 +84,16 @@ public partial class FarmingControls2D : Node2D
WateringCanState.Fill();
}
}
private void WaterTheField(Vector2I fieldPosition)
{
FieldBehaviour2D? field = FieldService.Instance.TryGet(_sceneKeyProvider.Payload.AsString(), 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)
private void MakeField(Vector2I mousePosition)
{
if(_fieldPrefab == null)
return;
// only instantiate a field if there isn't one already.
if(FieldService.Instance.TryGet(_sceneKeyProvider.Payload.AsString(), fieldPosition) == null)
{
Node fieldInstance = _fieldPrefab.Instantiate();
if (fieldInstance is Node2D field2d)
{
// add dictionary entry for the field
Array<Node> fields = field2d.FindChildren("*", nameof(FieldBehaviour2D));
if (fields.Count > 0)
{
FieldService.Instance.TryAddEntry(_sceneKeyProvider.Payload.AsString(), fieldPosition, fields[0] as FieldBehaviour2D);
}
// reposition and reparent the instance
field2d.Position = new Vector2(fieldPosition.X, fieldPosition.Y);
FieldService.Instance.AddChild(fieldInstance);
EmitSignal(SignalName.FieldCreated);
}
}
int potentialFieldIndex = FieldService.Instance.PositionToIndex(mousePosition);
if(FieldService.Instance.TryGet(_sceneKeyProvider.Payload.AsString(), potentialFieldIndex) == null)
EmitSignal(SignalName.FieldCreated);
}
#endregion
}
@@ -0,0 +1,27 @@
using Godot;
namespace Babushka.scripts.CSharp.Common.Farming;
public partial class FieldActivator : Node
{
[Export] private Node2D _field;
private bool _activated = false;
private bool _rakeInHand;
public void ActivateField()
{
if (!_activated && _rakeInHand)
{
GD.Print("Tryina activate this field right here....");
_field.Visible = true;
_activated = true;
}
}
public void RakeActivated(bool activated)
{
_rakeInHand = activated;
}
}
@@ -0,0 +1 @@
uid://dlbjjgbs0n4b0
@@ -1,6 +1,8 @@
using System;
using Babushka.scripts.CSharp.Common.CharacterControls;
using Babushka.scripts.CSharp.Common.Inventory;
using Babushka.scripts.CSharp.Low_Code.Events;
using Babushka.scripts.CSharp.Low_Code.Variables;
using Godot;
namespace Babushka.scripts.CSharp.Common.Farming;
@@ -20,21 +22,29 @@ public partial class FieldBehaviour2D : Sprite2D
[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;
[Signal] public delegate void PlantedEventHandler();
private void UpdateInteractionArea()
{
// fieldstate == tilled / watered && samen im Inventar
bool canPlant = (FieldState == FieldState.Tilled || FieldState == FieldState.Watered) && _seedsActive;
_canPlant = (FieldState == FieldState.Tilled || FieldState == FieldState.Watered) && _seedsActive;
// fieldstate == tilled && watering can ausgewählt
bool canWater = FieldState == FieldState.Tilled && _wateringCanActive;
FieldInteractionArea.IsActive = canPlant || canWater;
_canWater = FieldState == FieldState.Tilled && _wateringCanActive;
FieldInteractionArea.IsActive = _canPlant || _canWater;
}
public void ActivatedSeedInInventory(bool activated)
@@ -52,6 +62,7 @@ public partial class FieldBehaviour2D : Sprite2D
public override void _Ready()
{
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];
@@ -91,7 +102,13 @@ public partial class FieldBehaviour2D : Sprite2D
public void Water()
{
UpdateFieldState(FieldState.Watered);
if (WateringCanState.GetFillState() > 0)
{
UpdateFieldState(FieldState.Watered);
_wateringParticles.Emitting = true;
WateringCanState.Water();
_wateringEvent.Raise();
}
}
/// <summary>
@@ -99,11 +116,16 @@ public partial class FieldBehaviour2D : Sprite2D
/// </summary>
public void Farm()
{
if (TryPlant())
if (_canPlant || TryPlant())
{
EmitSignal(SignalName.Planted);
UpdateFieldState(FieldState.Planted);
}
if (_canWater)
{
Water();
}
}
private bool TryPlant()
@@ -136,5 +158,6 @@ public partial class FieldBehaviour2D : Sprite2D
return success;
}
}
+25 -15
View File
@@ -22,8 +22,9 @@ public partial class FieldService : Node
//Create
public bool TryAddEntry(string sceneName, Vector2I position, FieldBehaviour2D field)
public bool TryAddEntry(string sceneName, int fieldIndex, FieldBehaviour2D field)
{
GD.Print("Trying to add a field at: " + fieldIndex);
if (_outerDict != null )
{
FieldsInScene innerDict;
@@ -35,21 +36,25 @@ public partial class FieldService : Node
_outerDict.Add(sceneName, innerDict);
}
if (!innerDict.fields.ContainsKey(position))
if (!innerDict.fields.ContainsKey(fieldIndex))
{
innerDict.fields.Add(position, field);
innerDict.fields.Add(fieldIndex, field);
return true;
}
else
{
GD.PrintErr("Duplicate field at: " + fieldIndex);
}
}
return false;
}
// Read
public FieldBehaviour2D? TryGet(string key, Vector2I fieldPosition)
public FieldBehaviour2D? TryGet(string key, int fieldIndex)
{
if (_outerDict != null && _outerDict.TryGetValue(key, out FieldsInScene? field))
{
if (field.fields.TryGetValue(fieldPosition, out FieldBehaviour2D? fieldInstance))
if (field.fields.TryGetValue(fieldIndex, out FieldBehaviour2D? fieldInstance))
{
return fieldInstance;
}
@@ -59,42 +64,47 @@ public partial class FieldService : Node
//Update
public void UpdateEntry(string key, Vector2I fieldPosition, FieldBehaviour2D state)
public void UpdateEntry(string key, int fieldIndex, FieldBehaviour2D state)
{
if (_outerDict != null && _outerDict.TryGetValue(key, out FieldsInScene? field))
{
if (field.fields.ContainsKey(fieldPosition))
if (field.fields.ContainsKey(fieldIndex))
{
field.fields[fieldPosition] = state;
field.fields[fieldIndex] = state;
}
else
{
TryAddEntry(key, fieldPosition, state);
TryAddEntry(key, fieldIndex, state);
}
}
}
//Delete
public void RemoveEntry(string key, Vector2I fieldPosition)
public void RemoveEntry(string key, int fieldIndex)
{
if (_outerDict != null && _outerDict.TryGetValue(key, out FieldsInScene? field))
{
if (field.fields.ContainsKey(fieldPosition))
if (field.fields.ContainsKey(fieldIndex))
{
field.fields.Remove(fieldPosition);
field.fields.Remove(fieldIndex);
}
}
}
public int PositionToIndex(Vector2 position)
{
// some awesome code here
return 0;
}
}
internal class FieldsInScene
{
public Dictionary<Vector2I, FieldBehaviour2D?> fields;
public Dictionary<int, FieldBehaviour2D?> fields;
public FieldsInScene()
{
fields = new Dictionary<Vector2I, FieldBehaviour2D?>();
fields = new Dictionary<int, FieldBehaviour2D?>();
}
}
@@ -1,12 +1,9 @@
using System;
using Babushka.scripts.CSharp.Common.Animation;
using Babushka.scripts.CSharp.Common.Inventory;
using Godot;
namespace Babushka.scripts.CSharp.Common.Farming;
/// <summary>
/// Determines the behaviour of a plant in Babushka.
/// </summary>
@@ -23,8 +20,9 @@ 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;
/// <summary>
/// public accessor for the field reference
@@ -37,6 +35,7 @@ public partial class PlantBehaviour2D : Node2D
public override void _Ready()
{
GD.Print($"Ready: {Name}");
if (_state == PlantState.None)
{
_state = PlantState.Planted;
@@ -45,6 +44,8 @@ public partial class PlantBehaviour2D : Node2D
}
else
{
GD.Print("plant state not none.");
_calledOnReady = true;
GrowPlant();
}
}
@@ -60,9 +61,13 @@ public partial class PlantBehaviour2D : Node2D
/// </summary>
public void GrowPlant()
{
if (_field.FieldState != FieldState.Watered || _magicWordSaid != _magicWordNeeded)
return;
if (!_calledOnReady)
{
if (_field.FieldState != FieldState.Watered || _magicWordSaid != _magicWordNeeded)
return;
}
GD.Print("Growing plant.");
switch (_state)
{
case PlantState.None:
@@ -105,6 +110,7 @@ public partial class PlantBehaviour2D : Node2D
_field.UpdateFieldState(FieldState.Tilled);
_magicWordSaid = false;
_calledOnReady = false;
}
private Sprite2D GetRandomSprite(Sprite2D[] sprites)
@@ -0,0 +1,8 @@
using Godot;
namespace Babushka.scripts.CSharp.Low_Code.Variables;
public partial class VariableNode : Node
{
[Export] public Variant Payload { get; set; }
}
@@ -0,0 +1 @@
uid://j2mhvb45egej
@@ -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;
}
}
@@ -0,0 +1 @@
uid://dfpyjxivcuidr