Initial Farming setup complete

remotes/checkIfPRContentChanged-1749880758504311652/farming_mechanic
kziolkowski 8 months ago
parent 90616537bc
commit ff426b0494

@ -1,3 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArea3D_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F8a54226fa2e1c9371a8091f24cfd744aef11fe6869527dc23b9b837623a29b9_003FArea3D_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACastHelpers_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fd111abf504bf42b5968a609b168fd093b2e200_003Fbb_003F1c116fcd_003FCastHelpers_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACastHelpers_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fd111abf504bf42b5968a609b168fd093b2e200_003Fbb_003F1c116fcd_003FCastHelpers_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANode_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Ff1d69ec2da76ccf9bc8a75c8e0fdca9a7ba1adf8c8c9d5047e2fa5991c02eca_003FNode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>

@ -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

@ -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)

@ -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")

@ -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"

@ -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"]

@ -7,16 +7,41 @@ 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()
{
FieldState = FieldState.Watered;
@ -24,7 +49,7 @@ public partial class FieldBehaviour2D : Sprite2D
}
/// <summary>
/// Called when the player enters the field'S interaction area and presses <E>.
/// Called when the player enters the field's interaction area and presses <E>.
/// </summary>
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;
}
}
}

@ -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;
/// <summary>
/// Transitions the plant to its next groth stage.
/// Transitions the plant to its next growth stage.
/// </summary>
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)

Loading…
Cancel
Save