🐛 fixed rake triggering field interaction + watering can interaction
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://7pvvop5hfl01"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://iquhbkr7pqeg" path="res://scripts/CSharp/Common/Savegame/SaveCheats.cs" id="1_vcrak"]
|
||||||
|
[ext_resource type="Script" uid="uid://ca4s0algeij1h" path="res://scripts/CSharp/Common/Savegame/SaveIDProviderTool.cs" id="2_q0tmy"]
|
||||||
|
|
||||||
|
[node name="SaveSystem" type="Node"]
|
||||||
|
|
||||||
|
[node name="SaveGameCheat" type="Node" parent="."]
|
||||||
|
script = ExtResource("1_vcrak")
|
||||||
|
|
||||||
|
[node name="SaveIDProvider" type="Node" parent="."]
|
||||||
|
script = ExtResource("2_q0tmy")
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=25 format=3 uid="uid://b1d2e7ely6hyw"]
|
[gd_scene load_steps=26 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"]
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://l5ym7gi82l1b" path="res://art/ui/UI/Watercan-ui/Tropfen-ui-6.png" id="21_4mg73"]
|
[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="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"]
|
[ext_resource type="Script" uid="uid://dlbjjgbs0n4b0" path="res://scripts/CSharp/Common/Farming/FieldActivator.cs" id="22_57jmp"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://7pvvop5hfl01" path="res://prefabs/SaveSystem/save_system.tscn" id="24_avqr3"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_57jmp"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_57jmp"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
@@ -114,10 +115,11 @@ scale_amount_max = 0.8
|
|||||||
color = Color(0.400601, 0.62444, 0.791217, 1)
|
color = Color(0.400601, 0.62444, 0.791217, 1)
|
||||||
hue_variation_max = 0.4
|
hue_variation_max = 0.4
|
||||||
|
|
||||||
[node name="FieldActivator" type="Node2D" parent="." node_paths=PackedStringArray("_field", "_activatorArea")]
|
[node name="FieldActivator" type="Node2D" parent="." node_paths=PackedStringArray("_field", "_activatorArea") groups=["Saveable"]]
|
||||||
script = ExtResource("22_57jmp")
|
script = ExtResource("22_57jmp")
|
||||||
_field = NodePath("../FieldBehaviour")
|
_field = NodePath("../FieldBehaviour")
|
||||||
_activatorArea = NodePath("InteractionArea")
|
_activatorArea = NodePath("InteractionArea")
|
||||||
|
metadata/SaveID = "8ac5da1c-3ddd-4b76-94c2-d655a4f369c7"
|
||||||
|
|
||||||
[node name="InteractionArea" parent="FieldActivator" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("7_2eegd")]
|
[node name="InteractionArea" parent="FieldActivator" node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("7_2eegd")]
|
||||||
_spritesToOutline = [NodePath("../../OutlineSprite")]
|
_spritesToOutline = [NodePath("../../OutlineSprite")]
|
||||||
@@ -128,6 +130,8 @@ shape = SubResource("CircleShape2D_57jmp")
|
|||||||
[node name="Marker2D" type="Marker2D" parent="."]
|
[node name="Marker2D" type="Marker2D" parent="."]
|
||||||
gizmo_extents = 157.0
|
gizmo_extents = 157.0
|
||||||
|
|
||||||
|
[node name="SaveSystem" parent="." instance=ExtResource("24_avqr3")]
|
||||||
|
|
||||||
[connection signal="Planted" from="FieldBehaviour" to="PlantCreationEventRaiser" method="RaiseEvents"]
|
[connection signal="Planted" from="FieldBehaviour" to="PlantCreationEventRaiser" method="RaiseEvents"]
|
||||||
[connection signal="Interacted" from="FieldBehaviour/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 Seeds" to="FieldBehaviour" method="ActivatedSeedInInventory"]
|
||||||
@@ -137,3 +141,4 @@ gizmo_extents = 157.0
|
|||||||
[connection signal="Interacted" from="FieldActivator/InteractionArea" to="FieldActivator/InteractionArea" method="ToggleActive"]
|
[connection signal="Interacted" from="FieldActivator/InteractionArea" to="FieldActivator/InteractionArea" method="ToggleActive"]
|
||||||
|
|
||||||
[editable path="FieldActivator/InteractionArea"]
|
[editable path="FieldActivator/InteractionArea"]
|
||||||
|
[editable path="SaveSystem"]
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://bopv10dqm1knc"]
|
[gd_scene load_steps=4 format=3 uid="uid://bopv10dqm1knc"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://c6wnoif01ltld" path="res://scenes/scene_startMenu.tscn" id="1_15ton"]
|
[ext_resource type="PackedScene" uid="uid://c6wnoif01ltld" path="res://scenes/scene_startMenu.tscn" id="1_15ton"]
|
||||||
[ext_resource type="Script" uid="uid://bbp0dyddwdbl8" path="res://scripts/CSharp/Common/Savegame/WindowSettingsSync.cs" id="2_d3jfo"]
|
[ext_resource type="Script" uid="uid://bbp0dyddwdbl8" path="res://scripts/CSharp/Common/Savegame/WindowSettingsSync.cs" id="2_d3jfo"]
|
||||||
[ext_resource type="Script" uid="uid://iquhbkr7pqeg" path="res://scripts/CSharp/Common/Savegame/SaveCheats.cs" id="4_ocsjo"]
|
[ext_resource type="PackedScene" uid="uid://7pvvop5hfl01" path="res://prefabs/SaveSystem/save_system.tscn" id="3_s8cy4"]
|
||||||
[ext_resource type="Script" uid="uid://ca4s0algeij1h" path="res://scripts/CSharp/Common/Savegame/SaveIDProviderTool.cs" id="5_iyo8m"]
|
|
||||||
|
|
||||||
[node name="BabushkaSceneBootstrap" type="Node2D"]
|
[node name="BabushkaSceneBootstrap" type="Node2D"]
|
||||||
|
|
||||||
@@ -14,10 +13,4 @@
|
|||||||
[node name="WindowSettings" type="Node" parent="."]
|
[node name="WindowSettings" type="Node" parent="."]
|
||||||
script = ExtResource("2_d3jfo")
|
script = ExtResource("2_d3jfo")
|
||||||
|
|
||||||
[node name="SaveSystem" type="Node" parent="."]
|
[node name="SaveSystem" parent="." instance=ExtResource("3_s8cy4")]
|
||||||
|
|
||||||
[node name="SaveGameCheat" type="Node" parent="SaveSystem"]
|
|
||||||
script = ExtResource("4_ocsjo")
|
|
||||||
|
|
||||||
[node name="SaveIDProvider" type="Node" parent="SaveSystem"]
|
|
||||||
script = ExtResource("5_iyo8m")
|
|
||||||
|
|||||||
@@ -1765,7 +1765,7 @@ metadata/SaveID = "b3b47e69-6115-4405-8da6-508b783823d2"
|
|||||||
|
|
||||||
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField" index="1"]
|
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField" index="1"]
|
||||||
visible = true
|
visible = true
|
||||||
FieldState = 2
|
FieldState = 1
|
||||||
metadata/SaveID = "7a8210bf-479d-4b4c-9758-98d23e59d5d7"
|
metadata/SaveID = "7a8210bf-479d-4b4c-9758-98d23e59d5d7"
|
||||||
|
|
||||||
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField/FieldBehaviour" index="1"]
|
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField/FieldBehaviour" index="1"]
|
||||||
@@ -1794,7 +1794,7 @@ metadata/SaveID = "f536efd3-3da8-4ef5-a520-570220e6c19f"
|
|||||||
|
|
||||||
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField2" index="1"]
|
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField2" index="1"]
|
||||||
visible = true
|
visible = true
|
||||||
FieldState = 2
|
FieldState = 1
|
||||||
metadata/SaveID = "a1d8a0a2-c51c-4410-83c3-0edb31cbf2de"
|
metadata/SaveID = "a1d8a0a2-c51c-4410-83c3-0edb31cbf2de"
|
||||||
|
|
||||||
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField2/FieldBehaviour" index="1"]
|
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField2/FieldBehaviour" index="1"]
|
||||||
@@ -1823,7 +1823,7 @@ metadata/SaveID = "14ce64d5-8a4d-43b9-a8ff-3a57725c4dc8"
|
|||||||
|
|
||||||
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField3" index="1"]
|
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField3" index="1"]
|
||||||
visible = true
|
visible = true
|
||||||
FieldState = 2
|
FieldState = 1
|
||||||
metadata/SaveID = "79a65532-cb2b-4268-8eb0-8c41a3935cbb"
|
metadata/SaveID = "79a65532-cb2b-4268-8eb0-8c41a3935cbb"
|
||||||
|
|
||||||
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField3/FieldBehaviour" index="1"]
|
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField3/FieldBehaviour" index="1"]
|
||||||
@@ -1852,7 +1852,7 @@ metadata/SaveID = "6872ce5d-6f42-47d7-97e2-a7214ff3b08c"
|
|||||||
|
|
||||||
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField4" index="1"]
|
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField4" index="1"]
|
||||||
visible = true
|
visible = true
|
||||||
FieldState = 2
|
FieldState = 1
|
||||||
metadata/SaveID = "13fa64a3-01dc-4fd8-822e-0839c0da3163"
|
metadata/SaveID = "13fa64a3-01dc-4fd8-822e-0839c0da3163"
|
||||||
|
|
||||||
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField4/FieldBehaviour" index="1"]
|
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField4/FieldBehaviour" index="1"]
|
||||||
@@ -1881,7 +1881,7 @@ metadata/SaveID = "f163c38d-9ee0-4844-9def-479833febb4e"
|
|||||||
|
|
||||||
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField5" index="1"]
|
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField5" index="1"]
|
||||||
visible = true
|
visible = true
|
||||||
FieldState = 2
|
FieldState = 1
|
||||||
metadata/SaveID = "414ecdb9-f3c4-4fb9-81bd-6ca575784f78"
|
metadata/SaveID = "414ecdb9-f3c4-4fb9-81bd-6ca575784f78"
|
||||||
|
|
||||||
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField5/FieldBehaviour" index="1"]
|
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField5/FieldBehaviour" index="1"]
|
||||||
@@ -1910,7 +1910,7 @@ metadata/SaveID = "da691381-ee82-4f86-abf3-dda2c9f19337"
|
|||||||
|
|
||||||
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField6" index="1"]
|
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField6" index="1"]
|
||||||
visible = true
|
visible = true
|
||||||
FieldState = 2
|
FieldState = 1
|
||||||
metadata/SaveID = "b235febb-b231-4f8c-94e9-1f9d9f115b08"
|
metadata/SaveID = "b235febb-b231-4f8c-94e9-1f9d9f115b08"
|
||||||
|
|
||||||
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField6/FieldBehaviour" index="1"]
|
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField6/FieldBehaviour" index="1"]
|
||||||
@@ -1939,7 +1939,7 @@ metadata/SaveID = "8116fa8b-b164-4d39-a1ed-6cd476d18f94"
|
|||||||
|
|
||||||
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField7" index="1"]
|
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField7" index="1"]
|
||||||
visible = true
|
visible = true
|
||||||
FieldState = 2
|
FieldState = 1
|
||||||
metadata/SaveID = "9ccdba91-812a-4c13-9ee0-12472e174fc9"
|
metadata/SaveID = "9ccdba91-812a-4c13-9ee0-12472e174fc9"
|
||||||
|
|
||||||
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField7/FieldBehaviour" index="1"]
|
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField7/FieldBehaviour" index="1"]
|
||||||
@@ -1968,7 +1968,7 @@ metadata/SaveID = "5298f423-4c3b-45b5-94fb-d4aef36bac21"
|
|||||||
|
|
||||||
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField8" index="1"]
|
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField8" index="1"]
|
||||||
visible = true
|
visible = true
|
||||||
FieldState = 2
|
FieldState = 1
|
||||||
metadata/SaveID = "da44e54a-0b76-4888-ad8b-782a9d146fa3"
|
metadata/SaveID = "da44e54a-0b76-4888-ad8b-782a9d146fa3"
|
||||||
|
|
||||||
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField8/FieldBehaviour" index="1"]
|
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField8/FieldBehaviour" index="1"]
|
||||||
@@ -1997,7 +1997,7 @@ metadata/SaveID = "0de8dc13-5851-4471-be35-309cd6687ebc"
|
|||||||
|
|
||||||
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField9" index="1"]
|
[node name="FieldBehaviour" parent="YSorted/Farm visuals/FieldParent/BaseField9" index="1"]
|
||||||
visible = true
|
visible = true
|
||||||
FieldState = 2
|
FieldState = 1
|
||||||
metadata/SaveID = "9919b294-04a1-4a16-9783-38c8aa0e291c"
|
metadata/SaveID = "9919b294-04a1-4a16-9783-38c8aa0e291c"
|
||||||
|
|
||||||
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField9/FieldBehaviour" index="1"]
|
[node name="PlantPlaceholder" parent="YSorted/Farm visuals/FieldParent/BaseField9/FieldBehaviour" index="1"]
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
using Babushka.scripts.CSharp.Common.CharacterControls;
|
using Babushka.scripts.CSharp.Common.CharacterControls;
|
||||||
|
using Babushka.scripts.CSharp.Common.Savegame;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
|
||||||
namespace Babushka.scripts.CSharp.Common.Farming;
|
namespace Babushka.scripts.CSharp.Common.Farming;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables a preset field in the scene sothat it can be used for farming.
|
/// Enables a preset field in the scene sothat it can be used for farming.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class FieldActivator : Node
|
public partial class FieldActivator : Node, ISaveable
|
||||||
{
|
{
|
||||||
[Export] private FieldBehaviour2D _field;
|
[Export] private FieldBehaviour2D _field;
|
||||||
[Export] private InteractionArea2D _activatorArea;
|
[Export] private InteractionArea2D _activatorArea;
|
||||||
@@ -18,6 +20,7 @@ public partial class FieldActivator : Node
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
LoadFromSaveData();
|
||||||
ToggleInteractionArea();
|
ToggleInteractionArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,6 +36,7 @@ public partial class FieldActivator : Node
|
|||||||
EmitSignal(SignalName.FieldCreated, _field);
|
EmitSignal(SignalName.FieldCreated, _field);
|
||||||
_used = true;
|
_used = true;
|
||||||
ToggleInteractionArea();
|
ToggleInteractionArea();
|
||||||
|
UpdateSaveData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,5 +57,29 @@ public partial class FieldActivator : Node
|
|||||||
{
|
{
|
||||||
_activatorArea.IsActive = !_used && _rakeInHand;
|
_activatorArea.IsActive = !_used && _rakeInHand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateSaveData()
|
||||||
|
{
|
||||||
|
var payloadData = new Dictionary<string, Variant>
|
||||||
|
{
|
||||||
|
{ "field_activator_used", _used }
|
||||||
|
};
|
||||||
|
|
||||||
|
string id = GetMeta("SaveID").AsString();
|
||||||
|
SavegameService.AppendDataToSave( id, payloadData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadFromSaveData()
|
||||||
|
{
|
||||||
|
string id = GetMeta("SaveID").AsString();
|
||||||
|
|
||||||
|
Dictionary<string, Variant> save = SavegameService.GetSaveData(id);
|
||||||
|
if (save.Count > 0)
|
||||||
|
{
|
||||||
|
if (save.TryGetValue("field_activator_used", out Variant usedVar))
|
||||||
|
{
|
||||||
|
_used = usedVar.AsBool();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ public partial class FieldBehaviour2D : Sprite2D, ISaveable
|
|||||||
// fieldstate == tilled / watered && samen im Inventar
|
// fieldstate == tilled / watered && samen im Inventar
|
||||||
_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
|
||||||
_canWater = (FieldState == FieldState.Tilled || IsPlanted) && _wateringCanActive;
|
_canWater = (FieldState == FieldState.Tilled || IsPlanted) && _wateringCanActive && WateringCanState.GetFillState() > 0;
|
||||||
|
|
||||||
PlantingInteraction.IsActive = _canPlant || _canWater;
|
PlantingInteraction.IsActive = _canPlant || _canWater;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user