diff --git a/Babushka.sln.DotSettings.user b/Babushka.sln.DotSettings.user
index 79d2b6c..8a6aa15 100644
--- a/Babushka.sln.DotSettings.user
+++ b/Babushka.sln.DotSettings.user
@@ -1,3 +1,4 @@
ForceIncluded
- ForceIncluded
\ No newline at end of file
+ ForceIncluded
+ ForceIncluded
\ No newline at end of file
diff --git a/prefabs/Player2D.tscn b/prefabs/Player2D.tscn
index 5f7aaaa..241af7a 100644
--- a/prefabs/Player2D.tscn
+++ b/prefabs/Player2D.tscn
@@ -1202,7 +1202,7 @@ _farmingControls = NodePath("FarmingControls")
[node name="CharacterBody2D" type="CharacterBody2D" parent="." node_paths=PackedStringArray("_sprite")]
position = Vector2(0, 374)
-collision_layer = 3
+collision_layer = 4
collision_mask = 3
script = ExtResource("1_ssqtd")
_speed = 1500.0
diff --git a/prefabs/farm/base_field_2d.tscn b/prefabs/farm/base_field_2d.tscn
index d0f2ac3..624106f 100644
--- a/prefabs/farm/base_field_2d.tscn
+++ b/prefabs/farm/base_field_2d.tscn
@@ -19,7 +19,8 @@ script = ExtResource("2_femni")
Tilled = ExtResource("3_lsfck")
Watered = ExtResource("4_cus02")
-[node name="BasePlant" parent="FieldBehaviour" instance=ExtResource("5_femni")]
+[node name="BasePlant" parent="FieldBehaviour" node_paths=PackedStringArray("_field") instance=ExtResource("5_femni")]
+_field = NodePath("..")
[node name="BigPlant" parent="FieldBehaviour/BasePlant" index="2"]
position = Vector2(6, -161)
diff --git a/prefabs/interaction_area_2d.tscn b/prefabs/interaction_area_2d.tscn
index d4d739a..2d25bae 100644
--- a/prefabs/interaction_area_2d.tscn
+++ b/prefabs/interaction_area_2d.tscn
@@ -12,6 +12,7 @@ _area = NodePath("Area2D")
_label = NodePath("Label")
[node name="Area2D" type="Area2D" parent="."]
+collision_mask = 4
[node name="CollisionShape3D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_npluf")
diff --git a/project.godot b/project.godot
index 886239b..d6b49da 100644
--- a/project.godot
+++ b/project.godot
@@ -154,7 +154,8 @@ locale/translations=PackedStringArray("res://dialog/translations/dialogic_charac
[layer_names]
-2d_physics/layer_1="interaction itemss"
+2d_physics/layer_1="interaction items"
3d_physics/layer_1="General"
2d_physics/layer_2="Background elements"
+2d_physics/layer_3="player"
3d_physics/layer_5="Player"
diff --git a/scenes/Babushka_scene_farm_outside_2d.tscn b/scenes/Babushka_scene_farm_outside_2d.tscn
index 6a64d1a..08316b8 100644
--- a/scenes/Babushka_scene_farm_outside_2d.tscn
+++ b/scenes/Babushka_scene_farm_outside_2d.tscn
@@ -592,7 +592,7 @@ texture = ExtResource("20_if5vh")
[node name="StaticBody2D" type="StaticBody2D" parent="Fence/Fence"]
collision_layer = 2
-collision_mask = 2
+collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="Fence/Fence/StaticBody2D"]
position = Vector2(0.666672, 76)
@@ -608,7 +608,7 @@ texture = ExtResource("20_if5vh")
[node name="StaticBody2D" type="StaticBody2D" parent="Fence/Fence2"]
collision_layer = 2
-collision_mask = 2
+collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="Fence/Fence2/StaticBody2D"]
position = Vector2(0.266632, 172)
@@ -667,7 +667,7 @@ texture = ExtResource("2_lhtpe")
[node name="StaticBody2D" type="StaticBody2D" parent="Farm visuals/Static/House Mockup"]
collision_layer = 2
-collision_mask = 2
+collision_mask = 6
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Farm visuals/Static/House Mockup/StaticBody2D"]
position = Vector2(-257.6, 236.8)
@@ -680,6 +680,7 @@ metadata/_custom_type_script = "uid://dhxtdhfqx3bte"
[node name="Area2D" type="Area2D" parent="Farm visuals/FieldParent"]
position = Vector2(-48, -16)
+collision_mask = 5
[node name="CollisionShape2D" type="CollisionShape2D" parent="Farm visuals/FieldParent/Area2D"]
position = Vector2(-1264, 2980)
@@ -703,6 +704,7 @@ texture = ExtResource("21_ualyd")
offset = Vector2(0, -800)
[node name="StaticBody2D" type="StaticBody2D" parent="YSorted/Brünnen"]
+collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="YSorted/Brünnen/StaticBody2D"]
position = Vector2(116, -224)
@@ -718,20 +720,35 @@ shape = SubResource("CircleShape2D_p6n74")
[node name="BaseField" parent="." instance=ExtResource("26_vbdb2")]
position = Vector2(11280, 2560)
+[node name="FieldBehaviour" parent="BaseField" index="1"]
+FieldState = 3
+
[node name="BaseField2" parent="." instance=ExtResource("26_vbdb2")]
position = Vector2(11280, 3304)
+[node name="FieldBehaviour" parent="BaseField2" index="1"]
+FieldState = 3
+
[node name="BaseField3" parent="." instance=ExtResource("26_vbdb2")]
position = Vector2(12080, 3296)
+[node name="FieldBehaviour" parent="BaseField3" index="1"]
+FieldState = 3
+
[node name="BaseField4" parent="." instance=ExtResource("26_vbdb2")]
position = Vector2(12080, 2544)
+[node name="FieldBehaviour" parent="BaseField4" index="1"]
+FieldState = 3
+
[node name="Hoe Pickup" parent="." node_paths=PackedStringArray("_sprites") instance=ExtResource("27_klb81")]
position = Vector2(3264, 2120)
rotation = 3.3074
_sprites = NodePath("SpriteSwitcher2d")
+[node name="Area2D" parent="Hoe Pickup" index="0"]
+collision_mask = 5
+
[node name="CollisionShape3D" parent="Hoe Pickup/Area2D" index="0"]
shape = SubResource("CircleShape2D_kxdmn")
@@ -743,6 +760,9 @@ position = Vector2(6216, 2248)
_sprites = NodePath("ActiveInactive")
_id = 1
+[node name="Area2D" parent="Watercan Pickup" index="0"]
+collision_mask = 5
+
[node name="CollisionShape3D" parent="Watercan Pickup/Area2D" index="0"]
shape = SubResource("CircleShape2D_hukxv")
@@ -768,6 +788,14 @@ region_rect = Rect2(1, 1138, 418, 288)
[connection signal="InteractedTool" from="Watercan Pickup" to="YSorted/Player2d" method="ActivateTool"]
[editable path="YSorted/Brünnen/InteractionArea"]
+[editable path="BaseField"]
+[editable path="BaseField/FieldBehaviour/BasePlant"]
+[editable path="BaseField2"]
+[editable path="BaseField2/FieldBehaviour/BasePlant"]
+[editable path="BaseField3"]
+[editable path="BaseField3/FieldBehaviour/BasePlant"]
+[editable path="BaseField4"]
+[editable path="BaseField4/FieldBehaviour/BasePlant"]
[editable path="Hoe Pickup"]
[editable path="Watercan Pickup"]
[editable path="Watercan Pickup/ActiveInactive"]
diff --git a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs
index 620cfc9..519fdce 100644
--- a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs
+++ b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs
@@ -7,15 +7,40 @@ public partial class FieldBehaviour2D : Sprite2D
{
[Export] private Texture2D Tilled;
[Export] private Texture2D Watered;
- [Export] public FieldState FieldState = FieldState.Empty;
+ [Export] public FieldState FieldState = FieldState.Tilled;
public Vector2 FieldPosition;
public override void _Ready()
{
- Texture = Tilled;
+ UpdateFieldState(FieldState);
base._Ready();
}
+
+ public void UpdateFieldState(FieldState state)
+ {
+ switch (state)
+ {
+ case FieldState.Empty:
+ FieldState = FieldState.Empty;
+ break;
+ case FieldState.Tilled:
+ FieldState = FieldState.Tilled;
+ Texture = Tilled;
+ break;
+ case FieldState.Watered:
+ FieldState = FieldState.Watered;
+ Texture = Watered;
+ break;
+ case FieldState.Planted:
+ FieldState = FieldState.Planted;
+ break;
+ default:
+ FieldState = FieldState.NotFound;
+ break;
+ }
+ }
+
public void Water()
{
@@ -24,7 +49,7 @@ public partial class FieldBehaviour2D : Sprite2D
}
///
- /// Called when the player enters the field'S interaction area and presses .
+ /// Called when the player enters the field's interaction area and presses .
///
public void Farm()
{
@@ -34,7 +59,7 @@ public partial class FieldBehaviour2D : Sprite2D
Texture = Tilled;
FieldState = FieldState.Tilled;
break;
- case FieldState.Tilled:
+ case FieldState.Watered:
FieldState = FieldState.Planted;
break;
case FieldState.Planted:
@@ -42,6 +67,5 @@ public partial class FieldBehaviour2D : Sprite2D
default:
break;
}
-
}
}
\ No newline at end of file
diff --git a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs
index ce04894..82ec132 100644
--- a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs
+++ b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs
@@ -13,14 +13,18 @@ public partial class PlantBehaviour2D : Node2D
[Export] private Sprite2D[] _bigPlants;
[Export] private Sprite2D[] _readyPlants;
[Export] private PlantState _state = PlantState.None;
+ [Export] private FieldBehaviour2D _field;
private Sprite2D _currentPlantSprite = null;
///
- /// Transitions the plant to its next groth stage.
+ /// Transitions the plant to its next growth stage.
///
- public void Grow(int id)
+ public void Grow()
{
+ if (_field.FieldState != FieldState.Watered)
+ return;
+
switch (_state)
{
case PlantState.None:
@@ -54,6 +58,8 @@ public partial class PlantBehaviour2D : Node2D
default:
break;
}
+
+ _field.UpdateFieldState(FieldState.Tilled);
}
private Sprite2D GetRandomSprite(Sprite2D[] sprites)