🚧 watering fields kinda works now

feature/farming_bugfixes_and_magic_word
kziolkowski 2 months ago
parent d51cc461f7
commit b00b466045

@ -1,4 +1,4 @@
[gd_scene load_steps=487 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://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"] [ext_resource type="Script" uid="uid://cjbclkxesh3hc" path="res://scripts/CSharp/Common/CharacterControls/PlayerMovement.cs" id="2_1vqmv"]
@ -285,8 +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="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="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="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="Resource" uid="uid://fnb0n0w2ktuc" path="res://resources/low code/farming/var_cursorOnField.tres" id="474_ogmln"]
[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="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="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"] [ext_resource type="AudioStream" uid="uid://dpqvnogggvgea" path="res://audio/sfx/Footsteps/Single/Gravel/Reverb/SFX_Footstep_Gravel_06_R.wav" id="475_83c4i"]
@ -295,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://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://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="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://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://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"] [ext_resource type="Texture2D" uid="uid://du6x1h42smp6m" path="res://art/animation/Vesna2D/Vesna Anims Sequences/F02-Walk/0010.png" id="486_kobao"]
@ -481,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://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="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="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"] [ext_resource type="Script" uid="uid://cvkw4qd2hxksi" path="res://scripts/GdScript/dialogic_toggle.gd" id="819_4na52"]
[sub_resource type="CircleShape2D" id="CircleShape2D_ssqtd"] [sub_resource type="CircleShape2D" id="CircleShape2D_ssqtd"]
@ -2087,7 +2085,6 @@ stream_6/stream = ExtResource("476_deeju")
[node name="Vesna" type="Node2D" node_paths=PackedStringArray("_farmingControls", "_player2d", "_vesnaAnimations")] [node name="Vesna" type="Node2D" node_paths=PackedStringArray("_farmingControls", "_player2d", "_vesnaAnimations")]
y_sort_enabled = true y_sort_enabled = true
position = Vector2(0, 2)
script = ExtResource("1_yd5ep") script = ExtResource("1_yd5ep")
_farmingControls = NodePath("FarmingControls") _farmingControls = NodePath("FarmingControls")
_player2d = NodePath("CharacterBody2D") _player2d = NodePath("CharacterBody2D")
@ -2109,11 +2106,10 @@ position = Vector2(-24, -13)
shape = SubResource("CircleShape2D_ssqtd") shape = SubResource("CircleShape2D_ssqtd")
debug_color = Color(0.923708, 0.202722, 0.475262, 0.42) 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) position = Vector2(0, -374)
script = ExtResource("3_f6xmn") script = ExtResource("3_f6xmn")
_sprite = NodePath("Animated Sprites") _sprite = NodePath("Animated Sprites")
_wateringParticles = NodePath("../../pouring water vfx")
[node name="Animated Sprites" type="AnimatedSprite2D" parent="CharacterBody2D/visuals"] [node name="Animated Sprites" type="AnimatedSprite2D" parent="CharacterBody2D/visuals"]
position = Vector2(0, 450) position = Vector2(0, 450)
@ -2156,34 +2152,12 @@ _eventResources = Array[Object]([ExtResource("468_t1d6r")])
script = ExtResource("467_8hbu5") script = ExtResource("467_8hbu5")
_eventResources = Array[Object]([ExtResource("469_t1d6r")]) _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") script = ExtResource("817_6nrw3")
_sceneKeyProvider = ExtResource("471_83c4i") _sceneKeyProvider = ExtResource("471_83c4i")
_fieldPrefab = ExtResource("818_16w6h")
_movingPlayer = NodePath("../CharacterBody2D") _movingPlayer = NodePath("../CharacterBody2D")
_wateringParticles = NodePath("../pouring water vfx")
_wateringCanParticlesVerticalOffset = -100.0 _wateringCanParticlesVerticalOffset = -100.0
_fieldOffsetVector = Vector2i(735, 600) _fieldOffsetVector = Vector2i(735, 600)
_cursorOnField = ExtResource("474_ogmln")
[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
[node name="DialogicToggle" type="Node2D" parent="." node_paths=PackedStringArray("itemToToggle")] [node name="DialogicToggle" type="Node2D" parent="." node_paths=PackedStringArray("itemToToggle")]
scale = Vector2(0.7, 0.7) scale = Vector2(0.7, 0.7)
@ -2200,6 +2174,10 @@ script = ExtResource("471_2f15g")
[node name="Timer" type="Timer" parent="SFX/FootstepsAudio"] [node name="Timer" type="Timer" parent="SFX/FootstepsAudio"]
wait_time = 0.5 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="FilledWateringCan" from="." to="CharacterBody2D/WateringCanUI" method="Refill"]
[connection signal="InventorySelectionChanged" from="." to="CharacterBody2D/WateringCanUI" method="IsWateringCanActive"] [connection signal="InventorySelectionChanged" from="." to="CharacterBody2D/WateringCanUI" method="IsWateringCanActive"]
[connection signal="PickedUpTool" from="." to="CharacterBody2D/visuals" method="ActivateTool"] [connection signal="PickedUpTool" from="." to="CharacterBody2D/visuals" method="ActivateTool"]
@ -2207,7 +2185,7 @@ wait_time = 0.5
[connection signal="LookDirection" from="CharacterBody2D/visuals" to="CharacterBody2D/DetectionCross" method="SetDirection"] [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/PlantCreatedEventListener" to="CharacterBody2D/visuals" method="PlayFarmingAnimation"]
[connection signal="EventRaised" from="CharacterBody2D/PickedUpInteractableListener" to="CharacterBody2D/visuals" method="PlayPickUpAnimation"] [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="timelineStarted" from="DialogicToggle" to="SFX/FootstepsAudio/Timer" method="stop"]
[connection signal="timeout" from="SFX/FootstepsAudio/Timer" to="SFX/FootstepsAudio" method="PlayOneShot"] [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"]

@ -1,4 +1,4 @@
[gd_scene load_steps=23 format=3 uid="uid://b1d2e7ely6hyw"] [gd_scene load_steps=22 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://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="Script" uid="uid://bdffon388rkty" path="res://scripts/CSharp/Common/Farming/FieldBehaviour2D.cs" id="1_qa01x"]
@ -15,21 +15,18 @@
[ext_resource type="Texture2D" uid="uid://bovypw2hsn2nq" path="res://art/masks/field_outline_1_outline.png" id="9_wx561"] [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://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://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="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://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://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="Resource" uid="uid://cndd64batns31" path="res://resources/items/wateringcan.tres" id="17_1mi0u"]
[ext_resource type="Script" uid="uid://dfpyjxivcuidr" path="res://scripts/CSharp/Low Code/Variables/VariableSetter.cs" id="19_lgya6"] [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://fnb0n0w2ktuc" path="res://resources/low code/farming/var_cursorOnField.tres" id="20_lgya6"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_57jmp"]
size = Vector2(600, 400)
[node name="BaseField" type="Node2D"] [node name="BaseField" type="Node2D"]
script = ExtResource("1_4mg73") script = ExtResource("1_4mg73")
Payload = 0 Payload = 0
[node name="FieldBehaviour" type="Sprite2D" parent="." node_paths=PackedStringArray("_fieldSprite", "_maskSprite", "_outlineSprite", "PlantingInteraction", "PlantingPlaceholder", "FieldInteractionArea", "_fieldIndex")] [node name="FieldBehaviour" type="Sprite2D" parent="." node_paths=PackedStringArray("_fieldSprite", "_maskSprite", "_outlineSprite", "PlantingInteraction", "PlantingPlaceholder", "FieldInteractionArea", "_fieldIndex", "_wateringParticles")]
z_index = -1 z_index = -1
scale = Vector2(0.9, 1) scale = Vector2(0.9, 1)
script = ExtResource("1_qa01x") script = ExtResource("1_qa01x")
@ -46,6 +43,8 @@ ItemRepository = ExtResource("7_w8caw")
FieldInteractionArea = NodePath("../InteractionArea") FieldInteractionArea = NodePath("../InteractionArea")
_sceneKeyProvider = ExtResource("11_cjahb") _sceneKeyProvider = ExtResource("11_cjahb")
_fieldIndex = NodePath("..") _fieldIndex = NodePath("..")
_wateringParticles = NodePath("../pouring water vfx")
_wateringEvent = ExtResource("14_57jmp")
[node name="MaskedField" type="Sprite2D" parent="FieldBehaviour"] [node name="MaskedField" type="Sprite2D" parent="FieldBehaviour"]
clip_children = 1 clip_children = 1
@ -80,24 +79,26 @@ _itemResourcesToListenFor = Array[Object]([ExtResource("15_i4qwg"), ExtResource(
script = ExtResource("14_w08sx") script = ExtResource("14_w08sx")
_itemResourcesToListenFor = Array[Object]([ExtResource("17_1mi0u")]) _itemResourcesToListenFor = Array[Object]([ExtResource("17_1mi0u")])
[node name="CursorOnFieldCollider" type="Area2D" parent="."] [node name="pouring water vfx" type="CPUParticles2D" parent="."]
position = Vector2(0, -300)
[node name="CollisionShape2D" type="CollisionShape2D" parent="CursorOnFieldCollider"] emitting = false
shape = SubResource("RectangleShape2D_57jmp") amount = 25
texture = ExtResource("21_4mg73")
[node name="CursorOnFieldSetter" type="Node" parent="CursorOnFieldCollider"] one_shot = true
script = ExtResource("19_lgya6") randomness = 1.0
_variableResource = ExtResource("20_lgya6") local_coords = true
_payloadToSet = true draw_order = 1
emission_shape = 2
[node name="CursorNotOnFieldSetter" type="Node" parent="CursorOnFieldCollider"] emission_sphere_radius = 128.0
script = ExtResource("19_lgya6") gravity = Vector2(0, 500)
_variableResource = ExtResource("20_lgya6") linear_accel_min = 44.07
_payloadToSet = false 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
[connection signal="Planted" from="FieldBehaviour" to="PlantCreationEventRaiser" method="RaiseEvents"] [connection signal="Planted" from="FieldBehaviour" to="PlantCreationEventRaiser" method="RaiseEvents"]
[connection signal="Interacted" from="InteractionArea" to="FieldBehaviour" method="Farm"] [connection signal="Interacted" from="InteractionArea" to="FieldBehaviour" method="Farm"]
[connection signal="ItemInstanceActivated" from="InventoryListener Seeds" to="FieldBehaviour" method="ActivatedSeedInInventory"] [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 watering can" to="FieldBehaviour" method="ActivateWateringCanInInventory"]
[connection signal="mouse_entered" from="CursorOnFieldCollider" to="CursorOnFieldCollider/CursorOnFieldSetter" method="Set"]
[connection signal="mouse_exited" from="CursorOnFieldCollider" to="CursorOnFieldCollider/CursorNotOnFieldSetter" method="Set"]

@ -6,7 +6,7 @@
[node name="DetectionCross" type="Node2D" node_paths=PackedStringArray("_detector")] [node name="DetectionCross" type="Node2D" node_paths=PackedStringArray("_detector")]
script = ExtResource("1_va8tx") script = ExtResource("1_va8tx")
_detector = NodePath("detector") _detector = NodePath("detector")
_xOffset = 300.0 _xOffset = 400.0
_yOffset = 300.0 _yOffset = 300.0
[node name="detector" parent="." instance=ExtResource("2_8hh05")] [node name="detector" parent="." instance=ExtResource("2_8hh05")]

@ -3,7 +3,7 @@
[ext_resource type="Script" uid="uid://c3pd60biootsx" path="res://scripts/CSharp/Common/CharacterControls/Detector.cs" id="1_6pib0"] [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"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_qwv4c"]
size = Vector2(100, 200) size = Vector2(100, 400)
[node name="detector" type="Area2D"] [node name="detector" type="Area2D"]
collision_layer = 4 collision_layer = 4

@ -149,6 +149,7 @@ directories/tres_directory={
"event_colorButtonClicked": "res://resources/low code/test/event_colorButtonClicked.tres", "event_colorButtonClicked": "res://resources/low code/test/event_colorButtonClicked.tres",
"event_newPlantCreated": "res://resources/low code/farming/event_newPlantCreated.tres", "event_newPlantCreated": "res://resources/low code/farming/event_newPlantCreated.tres",
"event_textLabelClicked": "res://resources/low code/test/event_textLabelClicked.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", "farming_equipment_glossary": "res://dialog/farming_equipment_glossary.tres",
"hoe": "res://resources/items/hoe.tres", "hoe": "res://resources/items/hoe.tres",
"inventory_interactable_outline": "res://art/materials/inventory_interactable_outline.tres", "inventory_interactable_outline": "res://art/materials/inventory_interactable_outline.tres",
@ -173,8 +174,8 @@ directories/tres_directory={
"unselected_stylebox": "res://addons/dialogic/Editor/Events/styles/unselected_stylebox.tres", "unselected_stylebox": "res://addons/dialogic/Editor/Events/styles/unselected_stylebox.tres",
"var_ColorTestValue": "res://resources/low code/test/var_ColorTestValue.tres", "var_ColorTestValue": "res://resources/low code/test/var_ColorTestValue.tres",
"var_Counter": "res://resources/low code/test/var_Counter.tres", "var_Counter": "res://resources/low code/test/var_Counter.tres",
"var_cursorOnField": "res://resources/low code/farming/var_cursorOnField.tres",
"var_sceneNameProvider": "res://resources/low code/farming/var_sceneNameProvider.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", "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_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", "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"

@ -1,8 +1,8 @@
[gd_resource type="Resource" script_class="VariableResource" load_steps=2 format=3 uid="uid://fnb0n0w2ktuc"] [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_nm02e"] [ext_resource type="Script" uid="uid://dtvx2cakx0bey" path="res://scripts/CSharp/Low Code/Variables/VariableResource.cs" id="1_qoiop"]
[resource] [resource]
script = ExtResource("1_nm02e") script = ExtResource("1_qoiop")
Payload = false Payload = Vector2(0, 0)
metadata/_custom_type_script = "uid://dtvx2cakx0bey" metadata/_custom_type_script = "uid://dtvx2cakx0bey"

@ -958,6 +958,7 @@ shape = SubResource("RectangleShape2D_0sfl7")
[node name="InteractionArea" parent="YSorted/Brünnen" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("31_xcb8u")] [node name="InteractionArea" parent="YSorted/Brünnen" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("31_xcb8u")]
_spritesToOutline = [NodePath("..")] _spritesToOutline = [NodePath("..")]
_id = 1
[node name="CollisionShape3D" parent="YSorted/Brünnen/InteractionArea/Area2D" index="0"] [node name="CollisionShape3D" parent="YSorted/Brünnen/InteractionArea/Area2D" index="0"]
position = Vector2(146, -130) position = Vector2(146, -130)
@ -1914,7 +1915,6 @@ _variableResource = ExtResource("57_hpgl7")
_payloadToSet = "beetRootScene" _payloadToSet = "beetRootScene"
[connection signal="FilledWateringCan" from="YSorted/Vesna" to="Audio/SFX/FillWater SFX2" method="PlayOneShot"] [connection signal="FilledWateringCan" from="YSorted/Vesna" to="Audio/SFX/FillWater SFX2" method="PlayOneShot"]
[connection signal="WateringField" from="YSorted/Vesna/FarmingControls" to="Audio/SFX/Watering SFX" method="PlayOneShot"]
[connection signal="InteractedTool" from="YSorted/Brünnen/InteractionArea" to="YSorted/Vesna" method="TryFillWateringCan"] [connection signal="InteractedTool" from="YSorted/Brünnen/InteractionArea" to="YSorted/Vesna" method="TryFillWateringCan"]
[connection signal="InteractedTool" from="YSorted/Blocker/BackToFarm" to="." method="LoadSceneAtIndex"] [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="finished" from="Audio/Background Music Ramp up" to="Audio/Background Music loop" method="PlayFromOffset"]

@ -8,7 +8,6 @@ namespace Babushka.scripts.CSharp.Common.Animation;
public partial class VesnaAnimations : Node public partial class VesnaAnimations : Node
{ {
[Export] private AnimatedSprite2D _sprite; [Export] private AnimatedSprite2D _sprite;
[Export] private CpuParticles2D _wateringParticles;
private bool anyActionPressed; private bool anyActionPressed;
private string _toolString; private string _toolString;
@ -144,7 +143,6 @@ public partial class VesnaAnimations : Node
_sprite.Animation = "diagonal wateringcan"; _sprite.Animation = "diagonal wateringcan";
_sprite.Play(); _sprite.Play();
InputService.Instance.InputEnabled = false; InputService.Instance.InputEnabled = false;
_wateringParticles.Emitting = true;
Task.Run(DelayedInputHandlerReset); Task.Run(DelayedInputHandlerReset);
} }
} }
@ -152,7 +150,6 @@ public partial class VesnaAnimations : Node
private async Task DelayedInputHandlerReset() private async Task DelayedInputHandlerReset()
{ {
await Task.Delay(1000); await Task.Delay(1000);
_wateringParticles.Emitting = false;
InputService.Instance.InputEnabled = true; InputService.Instance.InputEnabled = true;
} }

@ -11,17 +11,14 @@ public partial class FarmingControls2D : Node2D
[Export] private VariableResource _sceneKeyProvider; [Export] private VariableResource _sceneKeyProvider;
[Export] private Node2D _movingPlayer; [Export] private Node2D _movingPlayer;
[Export] private Camera2D _camera; [Export] private Camera2D _camera;
[Export] private CpuParticles2D _wateringParticles;
[Export] private float _wateringCanParticlesVerticalOffset = 50f; [Export] private float _wateringCanParticlesVerticalOffset = 50f;
[Export] private Vector2I _fieldOffsetVector = new Vector2I(735, 651); [Export] private Vector2I _fieldOffsetVector = new Vector2I(735, 651);
[Export] private Node2D _fieldParent; [Export] private Node2D _fieldParent;
[Export] private VariableResource _cursorOnField;
private int _toolId = -1; private int _toolId = -1;
private bool _wateringCanFilled = false; private bool _wateringCanFilled = false;
[Signal] public delegate void WateringFieldEventHandler();
[Signal] public delegate void FieldCreatedEventHandler(); [Signal] public delegate void FieldCreatedEventHandler();
#region Tools #region Tools
@ -58,14 +55,6 @@ public partial class FarmingControls2D : Node2D
{ {
if (@event.IsActionPressed("click")) if (@event.IsActionPressed("click"))
{ {
bool cursorOnField = _cursorOnField.Payload.AsBool();
if (_toolId == WateringCanState.WATERING_CAN_ID
&& WateringCanState.GetFillState() > 0)
{
Vector2I adjustedPosition = GetAdjustedMousePosition();
WaterTheField(adjustedPosition);
}
if ( _toolId == 0) if ( _toolId == 0)
{ {
Vector2I adjustedPosition = GetAdjustedMousePosition(); Vector2I adjustedPosition = GetAdjustedMousePosition();
@ -95,21 +84,6 @@ public partial class FarmingControls2D : Node2D
WateringCanState.Fill(); WateringCanState.Fill();
} }
} }
private void WaterTheField(Vector2I fieldPosition)
{
int potentialFieldIndex = FieldService.Instance.PositionToIndex(fieldPosition);
FieldBehaviour2D? field = FieldService.Instance.TryGet(_sceneKeyProvider.Payload.AsString(), potentialFieldIndex);
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 #endregion

@ -1,6 +1,7 @@
using System; using System;
using Babushka.scripts.CSharp.Common.CharacterControls; using Babushka.scripts.CSharp.Common.CharacterControls;
using Babushka.scripts.CSharp.Common.Inventory; using Babushka.scripts.CSharp.Common.Inventory;
using Babushka.scripts.CSharp.Low_Code.Events;
using Babushka.scripts.CSharp.Low_Code.Variables; using Babushka.scripts.CSharp.Low_Code.Variables;
using Godot; using Godot;
@ -23,6 +24,8 @@ public partial class FieldBehaviour2D : Sprite2D
[Export] public InteractionArea2D FieldInteractionArea; [Export] public InteractionArea2D FieldInteractionArea;
[Export] public VariableResource _sceneKeyProvider; [Export] public VariableResource _sceneKeyProvider;
[Export] private VariableNode _fieldIndex; [Export] private VariableNode _fieldIndex;
[Export] private CpuParticles2D _wateringParticles;
[Export] private EventResource _wateringEvent;
public Vector2 FieldPosition; public Vector2 FieldPosition;
@ -30,15 +33,18 @@ public partial class FieldBehaviour2D : Sprite2D
private bool _seedsActive; private bool _seedsActive;
private bool _wateringCanActive; private bool _wateringCanActive;
private bool _canPlant;
private bool _canWater;
[Signal] public delegate void PlantedEventHandler(); [Signal] public delegate void PlantedEventHandler();
private void UpdateInteractionArea() private void UpdateInteractionArea()
{ {
// fieldstate == tilled / watered && samen im Inventar // 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 // fieldstate == tilled && watering can ausgewählt
bool canWater = FieldState == FieldState.Tilled && _wateringCanActive; _canWater = FieldState == FieldState.Tilled && _wateringCanActive;
FieldInteractionArea.IsActive = canPlant || canWater; FieldInteractionArea.IsActive = _canPlant || _canWater;
} }
public void ActivatedSeedInInventory(bool activated) public void ActivatedSeedInInventory(bool activated)
@ -97,6 +103,9 @@ public partial class FieldBehaviour2D : Sprite2D
public void Water() public void Water()
{ {
UpdateFieldState(FieldState.Watered); UpdateFieldState(FieldState.Watered);
_wateringParticles.Emitting = true;
WateringCanState.Water();
_wateringEvent.Raise();
} }
/// <summary> /// <summary>
@ -104,11 +113,16 @@ public partial class FieldBehaviour2D : Sprite2D
/// </summary> /// </summary>
public void Farm() public void Farm()
{ {
if (TryPlant()) if (_canPlant || TryPlant())
{ {
EmitSignal(SignalName.Planted); EmitSignal(SignalName.Planted);
UpdateFieldState(FieldState.Planted); UpdateFieldState(FieldState.Planted);
} }
if (_canWater)
{
Water();
}
} }
private bool TryPlant() private bool TryPlant()

Loading…
Cancel
Save