diff --git a/prefabs/farm/base_field.tscn b/prefabs/farm/base_field.tscn
index 43016c8..cedce61 100644
--- a/prefabs/farm/base_field.tscn
+++ b/prefabs/farm/base_field.tscn
@@ -32,21 +32,29 @@ radius = 325.2599
script = ExtResource("1_4mg73")
Payload = 0
+[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("_fieldSprite", "_maskSprite", "_outlineSprite", "PlantingInteraction", "PlantingPlaceholder", "FieldInteractionArea", "_fieldIndex", "_wateringParticles")]
+visible = false
z_index = -1
scale = Vector2(0.9, 1)
script = ExtResource("1_qa01x")
_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")
+FieldState = 0
+PlantingInteraction = NodePath("InteractionArea")
PlantingPlaceholder = NodePath("PlantPlaceholder")
ItemRepository = ExtResource("7_w8caw")
-FieldInteractionArea = NodePath("../InteractionArea")
+FieldInteractionArea = NodePath("InteractionArea")
_sceneKeyProvider = ExtResource("11_cjahb")
_fieldIndex = NodePath("..")
_wateringParticles = NodePath("../pouring water vfx")
@@ -62,16 +70,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 +112,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"]
diff --git a/scenes/Babushka_scene_farm_outside_2d.tscn b/scenes/Babushka_scene_farm_outside_2d.tscn
index 16626c1..20f01ed 100644
--- a/scenes/Babushka_scene_farm_outside_2d.tscn
+++ b/scenes/Babushka_scene_farm_outside_2d.tscn
@@ -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,61 @@ scale = Vector2(1, 1)
[node name="FieldParent" type="Node2D" parent="YSorted"]
position = Vector2(0, -200)
+[node name="BaseField" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(8807, 3061)
+
+[node name="BaseField2" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(9335, 3562)
+Payload = 1
+
+[node name="BaseField3" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(9854, 3061)
+Payload = 2
+
+[node name="BaseField4" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(10499, 3536)
+Payload = 3
+
+[node name="BaseField5" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(11027, 3035)
+Payload = 4
+
+[node name="BaseField6" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(11394, 3617)
+Payload = 5
+
+[node name="BaseField7" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(11869, 3026)
+Payload = 6
+
+[node name="BaseField8" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(12353, 3554)
+Payload = 7
+
+[node name="BaseField9" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(12828, 2999)
+Payload = 8
+
+[node name="BaseField10" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(13285, 3536)
+Payload = 9
+
+[node name="BaseField11" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(13733, 2990)
+Payload = 10
+
+[node name="BaseField12" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(14261, 3474)
+Payload = 11
+
+[node name="BaseField13" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(14753, 2982)
+Payload = 12
+
+[node name="BaseField14" parent="YSorted/FieldParent" instance=ExtResource("78_xcwle")]
+position = Vector2(15201, 3519)
+Payload = 13
+
[node name="Farm visuals" type="Node2D" parent="YSorted"]
position = Vector2(-60, 122)
@@ -2400,7 +2456,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"]
diff --git a/scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn b/scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn
index 9cd1c59..bc363ac 100644
--- a/scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn
+++ b/scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn
@@ -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"]
diff --git a/scenes/Babushka_scene_forest_fight_1_2d.tscn b/scenes/Babushka_scene_forest_fight_1_2d.tscn
index 860d079..5b218ae 100644
--- a/scenes/Babushka_scene_forest_fight_1_2d.tscn
+++ b/scenes/Babushka_scene_forest_fight_1_2d.tscn
@@ -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"]
diff --git a/scenes/Babushka_scene_outside_beets.tscn b/scenes/Babushka_scene_outside_beets.tscn
index 79d6c14..4d8cc2f 100644
--- a/scenes/Babushka_scene_outside_beets.tscn
+++ b/scenes/Babushka_scene_outside_beets.tscn
@@ -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="8"]
+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="8"]
+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="8"]
+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="8"]
+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="8"]
+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="8"]
+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="8"]
+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="8"]
+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="8"]
+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"]
diff --git a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs
index dd0d07a..9a421cd 100644
--- a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs
+++ b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs
@@ -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;
}
diff --git a/scripts/CSharp/Common/Farming/FieldActivator.cs b/scripts/CSharp/Common/Farming/FieldActivator.cs
index a2e2ca5..926098f 100644
--- a/scripts/CSharp/Common/Farming/FieldActivator.cs
+++ b/scripts/CSharp/Common/Farming/FieldActivator.cs
@@ -1,27 +1,51 @@
+using Babushka.scripts.CSharp.Common.CharacterControls;
using Godot;
namespace Babushka.scripts.CSharp.Common.Farming;
+///
+/// Enables a preset field in the scene sothat it can be used for farming.
+///
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();
+ }
+
+ ///
+ /// Activates the fieldbehaviour node and sets it to the tilled state.
+ ///
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;
}
}
+ ///
+ /// Reacts to changes in the inventory.
+ /// If setup correctly, the field activator interactable should only trigger when using the rake.
+ ///
+ ///
public void RakeActivated(bool activated)
{
_rakeInHand = activated;
+ ToggleInteractionArea();
+ }
+
+ private void ToggleInteractionArea()
+ {
+ _activatorArea.IsActive = !_used && _rakeInHand;
}
}
\ No newline at end of file
diff --git a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs
index 809aee2..639d77d 100644
--- a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs
+++ b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs
@@ -43,7 +43,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;
}
@@ -116,7 +116,7 @@ public partial class FieldBehaviour2D : Sprite2D
///
public void Farm()
{
- if (_canPlant || TryPlant())
+ if (_canPlant && TryPlant())
{
EmitSignal(SignalName.Planted);
UpdateFieldState(FieldState.Planted);
@@ -133,7 +133,7 @@ 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;
@@ -155,7 +155,7 @@ public partial class FieldBehaviour2D : Sprite2D
InventoryManager.Instance.playerInventory.RemoveItem(currentSlotIndex);
success = true;
}
-
+
return success;
}
diff --git a/scripts/CSharp/Common/Farming/FieldService.cs b/scripts/CSharp/Common/Farming/FieldService.cs
index 0e41dc8..5bc1aee 100644
--- a/scripts/CSharp/Common/Farming/FieldService.cs
+++ b/scripts/CSharp/Common/Farming/FieldService.cs
@@ -24,7 +24,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;
diff --git a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs
index 910a5f3..9a87166 100644
--- a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs
+++ b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs
@@ -67,7 +67,6 @@ public partial class PlantBehaviour2D : Node2D
return;
}
- GD.Print("Growing plant.");
switch (_state)
{
case PlantState.None: