From d2c7302ab291372f5172c22ae12285e4fb738b93 Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Thu, 17 Jul 2025 20:44:28 +0200 Subject: [PATCH 01/20] Fixed farming (the way it was before) --- export_presets.cfg | 4 +- prefabs/farm/tomato_field.tscn | 29 ++++++---- prefabs/farm/tomato_plant.tscn | 31 +++++++--- .../generic_item_on_ground_2d.tscn | 10 ++-- scenes/Babushka_scene_bootstrap.tscn | 1 - scenes/Babushka_scene_farm_outside_2d.tscn | 56 +++++++++++-------- .../CharacterControls/InteractionArea2D.cs | 1 + .../CSharp/Common/Farming/PlantBehaviour2D.cs | 5 +- .../CSharp/Common/Inventory/ItemOnGround2D.cs | 2 +- 9 files changed, 86 insertions(+), 53 deletions(-) diff --git a/export_presets.cfg b/export_presets.cfg index 0fc5ab5..408bddd 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -9,7 +9,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="_builds/Babushka_win_0_3/Babushka.exe" +export_path="_builds/Babushka_showcase_win_04/Babushka.exe" patches=PackedStringArray() encryption_include_filters="" encryption_exclude_filters="" @@ -79,7 +79,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="_builds/Babushka_linux_0_2/Babushka.x86_64" +export_path="_builds/Babushka_showcase_lux_04/Babushka.x86_64" patches=PackedStringArray() encryption_include_filters="" encryption_exclude_filters="" diff --git a/prefabs/farm/tomato_field.tscn b/prefabs/farm/tomato_field.tscn index bbfe8ec..32598bf 100644 --- a/prefabs/farm/tomato_field.tscn +++ b/prefabs/farm/tomato_field.tscn @@ -1,6 +1,5 @@ [gd_scene load_steps=10 format=3 uid="uid://b1d2e7ely6hyw"] -[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="1_jrdc4"] [ext_resource type="Script" uid="uid://bdffon388rkty" path="res://scripts/CSharp/Common/Farming/FieldBehaviour2D.cs" id="2_vl3uw"] [ext_resource type="Texture2D" uid="uid://cgmu3qlovdr22" path="res://art/masks/field_outline_1.png" id="3_uqkef"] [ext_resource type="Texture2D" uid="uid://eg5ej0mtuac" path="res://art/masks/field_outline_2.png" id="4_di17a"] @@ -9,16 +8,15 @@ [ext_resource type="Texture2D" uid="uid://ctvdxwgmfaj5c" path="res://art/farm/tilable grounds/böden/nasse farming erde.png" id="7_f504p"] [ext_resource type="PackedScene" uid="uid://gishbn0a8eke" path="res://prefabs/farm/tomato_plant.tscn" id="8_jrdc4"] -[sub_resource type="CircleShape2D" id="CircleShape2D_vl3uw"] +[sub_resource type="CircleShape2D" id="CircleShape2D_jrdc4"] resource_local_to_scene = true radius = 300.0 -[node name="BaseField" type="Node2D"] +[sub_resource type="CircleShape2D" id="CircleShape2D_l0vvv"] +resource_local_to_scene = true +radius = 300.0 -[node name="InteractionArea2" parent="." instance=ExtResource("1_jrdc4")] -visible = false -z_index = 1 -scale = Vector2(2.225, 2.225) +[node name="BaseField" type="Node2D"] [node name="FieldBehaviour" type="Sprite2D" parent="." node_paths=PackedStringArray("_fieldSprite", "_maskSprite", "_growingCollider")] z_index = -1 @@ -29,13 +27,21 @@ _maskSprite = NodePath("MaskedField") _maskTexture = Array[Texture2D]([ExtResource("3_uqkef"), ExtResource("4_di17a"), ExtResource("5_4a8nv")]) Tilled = ExtResource("6_l7j4c") Watered = ExtResource("7_f504p") -_growingCollider = NodePath("BasePlant2/InteractionArea") +_growingCollider = NodePath("BasePlant2/GrowingInteractionArea") [node name="BasePlant2" parent="FieldBehaviour" node_paths=PackedStringArray("_field") groups=["PlantGrowing"] instance=ExtResource("8_jrdc4")] _field = NodePath("..") +_magicWordNeeded = false + +[node name="CollisionShape3D" parent="FieldBehaviour/BasePlant2/GrowingInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_jrdc4") + +[node name="Label" parent="FieldBehaviour/BasePlant2/GrowingInteractionArea" index="1"] +text = "[E] Grow +" -[node name="CollisionShape3D" parent="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem/InteractionArea2/Area2D" index="0"] -shape = SubResource("CircleShape2D_vl3uw") +[node name="CollisionShape3D" parent="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_l0vvv") [node name="MaskedField" type="Sprite2D" parent="FieldBehaviour"] clip_children = 1 @@ -46,5 +52,6 @@ texture = ExtResource("4_di17a") texture = ExtResource("6_l7j4c") [editable path="FieldBehaviour/BasePlant2"] +[editable path="FieldBehaviour/BasePlant2/GrowingInteractionArea"] [editable path="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem"] -[editable path="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem/InteractionArea2"] +[editable path="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem/PickupInteractionArea"] diff --git a/prefabs/farm/tomato_plant.tscn b/prefabs/farm/tomato_plant.tscn index 8f3e637..5e01f82 100644 --- a/prefabs/farm/tomato_plant.tscn +++ b/prefabs/farm/tomato_plant.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=12 format=3 uid="uid://gishbn0a8eke"] +[gd_scene load_steps=13 format=3 uid="uid://gishbn0a8eke"] [ext_resource type="Script" uid="uid://cms357f23fmfy" path="res://scripts/CSharp/Common/Farming/PlantBehaviour2D.cs" id="1_66p1c"] [ext_resource type="Texture2D" uid="uid://dtr4uga5uspg" path="res://art/farm/farming/farmobjekte/tomaten/tomaten baby.png" id="2_vjw4j"] @@ -22,7 +22,11 @@ shader_parameter/distortion = 0.0 shader_parameter/heightOffset = 0.635 shader_parameter/offset = 0.0 -[sub_resource type="CircleShape2D" id="CircleShape2D_2tt5u"] +[sub_resource type="CircleShape2D" id="CircleShape2D_vjw4j"] +resource_local_to_scene = true +radius = 300.0 + +[sub_resource type="CircleShape2D" id="CircleShape2D_7hdur"] resource_local_to_scene = true radius = 300.0 @@ -100,7 +104,7 @@ region_enabled = true region_rect = Rect2(228, 600, 85, 92) [node name="BigPlant" type="Node2D" parent="."] -position = Vector2(0, 2) +position = Vector2(0, -400) [node name="01" type="Sprite2D" parent="BigPlant"] visible = false @@ -134,9 +138,15 @@ texture = ExtResource("4_hmj2d") region_enabled = true region_rect = Rect2(546, 697, 535, 687) -[node name="InteractionArea" parent="." instance=ExtResource("5_3j24b")] +[node name="GrowingInteractionArea" parent="." instance=ExtResource("5_3j24b")] position = Vector2(0, 2.3) +[node name="CollisionShape3D" parent="GrowingInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_vjw4j") + +[node name="Label" parent="GrowingInteractionArea" index="1"] +text = "[E] Grow" + [node name="ReadyPlantInventoryItem" parent="." instance=ExtResource("6_gdrin")] position = Vector2(0, 2.3) IsActive = false @@ -150,13 +160,17 @@ visible = false [node name="PickupErrorLabel" parent="ReadyPlantInventoryItem" index="2"] visible = false -[node name="CollisionShape3D" parent="ReadyPlantInventoryItem/InteractionArea2/Area2D" index="0"] -shape = SubResource("CircleShape2D_2tt5u") +[node name="PickupInteractionArea" parent="ReadyPlantInventoryItem" index="3"] +visible = false + +[node name="CollisionShape3D" parent="ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_7hdur") [node name="Icon" parent="ReadyPlantInventoryItem" index="4"] visible = false [node name="ReadyPlant" type="Node2D" parent="ReadyPlantInventoryItem"] +position = Vector2(0, -400) [node name="01" type="Sprite2D" parent="ReadyPlantInventoryItem/ReadyPlant"] visible = false @@ -209,7 +223,8 @@ scale_amount_max = 0.1 color = Color(0.400601, 0.62444, 0.791217, 1) hue_variation_max = 0.4 -[connection signal="Interacted" from="InteractionArea" to="." method="Grow"] +[connection signal="Interacted" from="GrowingInteractionArea" to="." method="Grow"] +[editable path="GrowingInteractionArea"] [editable path="ReadyPlantInventoryItem"] -[editable path="ReadyPlantInventoryItem/InteractionArea2"] +[editable path="ReadyPlantInventoryItem/PickupInteractionArea"] diff --git a/prefabs/interactions/generic_item_on_ground_2d.tscn b/prefabs/interactions/generic_item_on_ground_2d.tscn index 2579b11..472bd23 100644 --- a/prefabs/interactions/generic_item_on_ground_2d.tscn +++ b/prefabs/interactions/generic_item_on_ground_2d.tscn @@ -43,12 +43,12 @@ theme = SubResource("Theme_harr4") text = "thewe waf a pwoblem wiph picking up te item UWU" autowrap_mode = 3 -[node name="InteractionArea2" parent="." instance=ExtResource("4_xu8me")] +[node name="PickupInteractionArea" parent="." instance=ExtResource("4_xu8me")] -[node name="CollisionShape3D" parent="InteractionArea2/Area2D" index="0"] +[node name="CollisionShape3D" parent="PickupInteractionArea/Area2D" index="0"] shape = SubResource("CircleShape2D_tlhp6") -[node name="Label" parent="InteractionArea2" index="1"] +[node name="Label" parent="PickupInteractionArea" index="1"] z_index = 5 offset_left = -68.0 offset_top = -111.0 @@ -62,6 +62,6 @@ position = Vector2(5, -300) scale = Vector2(0.868852, 0.868852) texture = ExtResource("5_harr4") -[connection signal="Interacted" from="InteractionArea2" to="." method="TryPickUp"] +[connection signal="Interacted" from="PickupInteractionArea" to="." method="TryPickUp"] -[editable path="InteractionArea2"] +[editable path="PickupInteractionArea"] diff --git a/scenes/Babushka_scene_bootstrap.tscn b/scenes/Babushka_scene_bootstrap.tscn index e50ff18..5b1809d 100644 --- a/scenes/Babushka_scene_bootstrap.tscn +++ b/scenes/Babushka_scene_bootstrap.tscn @@ -5,6 +5,5 @@ [node name="BabushkaSceneBootstrap" type="Node2D"] [node name="BabushkaSceneStartMenu" parent="." instance=ExtResource("1_15ton")] -_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_disclaimer.tscn") [node name="SceneParent" type="Node" parent="."] diff --git a/scenes/Babushka_scene_farm_outside_2d.tscn b/scenes/Babushka_scene_farm_outside_2d.tscn index 95c02c4..b48a256 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=102 format=3 uid="uid://gigb28qk8t12"] +[gd_scene load_steps=105 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"] @@ -153,11 +153,23 @@ size = Vector2(1041, 368) resource_local_to_scene = true radius = 371.058 -[sub_resource type="CircleShape2D" id="CircleShape2D_2nee2"] +[sub_resource type="CircleShape2D" id="CircleShape2D_ycj14"] resource_local_to_scene = true radius = 300.0 -[sub_resource type="CircleShape2D" id="CircleShape2D_ipqaa"] +[sub_resource type="CircleShape2D" id="CircleShape2D_2065p"] +resource_local_to_scene = true +radius = 300.0 + +[sub_resource type="CircleShape2D" id="CircleShape2D_tm0yg"] +resource_local_to_scene = true +radius = 300.0 + +[sub_resource type="CircleShape2D" id="CircleShape2D_lbnqo"] +resource_local_to_scene = true +radius = 300.0 + +[sub_resource type="CircleShape2D" id="CircleShape2D_l4wxt"] resource_local_to_scene = true radius = 300.0 @@ -1011,7 +1023,7 @@ _timelinesToPlay = PackedStringArray("quest1_ducks_start", "quest2_tomatoes_star [node name="Vesna" parent="YSorted" node_paths=PackedStringArray("_fieldParent") instance=ExtResource("1_7wfwe")] z_index = 1 -position = Vector2(-2031, 2949) +position = Vector2(9322, 2018) _fieldParent = NodePath("../Farm visuals/FieldParent") _hoe = ExtResource("28_6b2nr") _wateringCan = ExtResource("28_ipqaa") @@ -1050,8 +1062,8 @@ position = Vector2(6095, 2087) [node name="SpawnWithItem" parent="YSorted/HoeGenericPickup" index="0"] _blueprint = ExtResource("26_ipqaa") -[node name="CollisionShape3D" parent="YSorted/HoeGenericPickup/InteractionArea2/Area2D" index="0"] -shape = SubResource("CircleShape2D_2nee2") +[node name="CollisionShape3D" parent="YSorted/HoeGenericPickup/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_ycj14") [node name="CanGenericPickup" parent="YSorted" instance=ExtResource("25_hukxv")] position = Vector2(8192, 3507) @@ -1059,11 +1071,8 @@ position = Vector2(8192, 3507) [node name="SpawnWithItem" parent="YSorted/CanGenericPickup" index="0"] _blueprint = ExtResource("28_ipqaa") -[node name="InteractionArea2" parent="YSorted/CanGenericPickup" index="3"] -position = Vector2(0, -159) - -[node name="CollisionShape3D" parent="YSorted/CanGenericPickup/InteractionArea2/Area2D" index="0"] -shape = SubResource("CircleShape2D_ipqaa") +[node name="CollisionShape3D" parent="YSorted/CanGenericPickup/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_2065p") [node name="RakeGenericPickup" parent="YSorted" instance=ExtResource("25_hukxv")] position = Vector2(8391, 2060) @@ -1071,8 +1080,8 @@ position = Vector2(8391, 2060) [node name="SpawnWithItem" parent="YSorted/RakeGenericPickup" index="0"] _blueprint = ExtResource("28_6b2nr") -[node name="CollisionShape3D" parent="YSorted/RakeGenericPickup/InteractionArea2/Area2D" index="0"] -shape = SubResource("CircleShape2D_ipqaa") +[node name="CollisionShape3D" parent="YSorted/RakeGenericPickup/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_tm0yg") [node name="ScytheGenericPickup" parent="YSorted" instance=ExtResource("25_hukxv")] visible = false @@ -1081,8 +1090,8 @@ position = Vector2(15642, 2158) [node name="SpawnWithItem" parent="YSorted/ScytheGenericPickup" index="0"] _blueprint = ExtResource("29_wtdui") -[node name="CollisionShape3D" parent="YSorted/ScytheGenericPickup/InteractionArea2/Area2D" index="0"] -shape = SubResource("CircleShape2D_ipqaa") +[node name="CollisionShape3D" parent="YSorted/ScytheGenericPickup/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_lbnqo") [node name="ShovelGenericPickup" parent="YSorted" instance=ExtResource("25_hukxv")] visible = false @@ -1091,8 +1100,8 @@ position = Vector2(5454, 2049) [node name="SpawnWithItem" parent="YSorted/ShovelGenericPickup" index="0"] _blueprint = ExtResource("27_ipqaa") -[node name="CollisionShape3D" parent="YSorted/ShovelGenericPickup/InteractionArea2/Area2D" index="0"] -shape = SubResource("CircleShape2D_ipqaa") +[node name="CollisionShape3D" parent="YSorted/ShovelGenericPickup/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_l4wxt") [node name="Farm visuals" type="Node2D" parent="YSorted"] position = Vector2(-60, 122) @@ -2071,10 +2080,11 @@ rotation = 1.5708 scale = Vector2(0.1, 10.8) texture = ExtResource("21_if5vh") -[node name="FieldParent" type="Node2D" parent="YSorted/Farm visuals"] +[node name="FieldParent" type="Node2D" parent="YSorted/Farm visuals" node_paths=PackedStringArray("_allowedArea")] position = Vector2(53, 20) scale = Vector2(1, 0.993819) script = ExtResource("25_0qu0h") +_allowedArea = NodePath("Area2D") metadata/_custom_type_script = "uid://dhxtdhfqx3bte" [node name="Area2D" type="Area2D" parent="YSorted/Farm visuals/FieldParent"] @@ -2305,14 +2315,14 @@ script = ExtResource("40_w3jkj") [editable path="YSorted/Vesna"] [editable path="YSorted/Brünnen/InteractionArea"] [editable path="YSorted/HoeGenericPickup"] -[editable path="YSorted/HoeGenericPickup/InteractionArea2"] +[editable path="YSorted/HoeGenericPickup/PickupInteractionArea"] [editable path="YSorted/CanGenericPickup"] -[editable path="YSorted/CanGenericPickup/InteractionArea2"] +[editable path="YSorted/CanGenericPickup/PickupInteractionArea"] [editable path="YSorted/RakeGenericPickup"] -[editable path="YSorted/RakeGenericPickup/InteractionArea2"] +[editable path="YSorted/RakeGenericPickup/PickupInteractionArea"] [editable path="YSorted/ScytheGenericPickup"] -[editable path="YSorted/ScytheGenericPickup/InteractionArea2"] +[editable path="YSorted/ScytheGenericPickup/PickupInteractionArea"] [editable path="YSorted/ShovelGenericPickup"] -[editable path="YSorted/ShovelGenericPickup/InteractionArea2"] +[editable path="YSorted/ShovelGenericPickup/PickupInteractionArea"] [editable path="YSorted/trash/trashObject"] [editable path="CanvasLayer"] diff --git a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs index 5c741fe..8200e85 100644 --- a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs +++ b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs @@ -42,6 +42,7 @@ public partial class InteractionArea2D : Node2D _label.Hide(); EmitSignal(SignalName.InteractedTool, _id); EmitSignal(SignalName.Interacted); + GD.Print("Interacted with: " + this.Name); } } diff --git a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs index e386ba4..267ee7d 100644 --- a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs +++ b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs @@ -27,10 +27,11 @@ public partial class PlantBehaviour2D : Node2D [Export] private FieldBehaviour2D _field; [Export] private ItemOnGround2D _harvestablePlant; [Export] private CpuParticles2D _magicEffect; + [Export] private bool _magicWordNeeded = true; private string _magicWordDialogicEventName = "MagicWord"; private Sprite2D _currentPlantSprite = null; - private bool _magicWordSaid; + private bool _magicWordSaid = false; /// @@ -38,7 +39,7 @@ public partial class PlantBehaviour2D : Node2D /// public void Grow() { - if (_field.FieldState != FieldState.Watered || !_magicWordSaid) + if (_field.FieldState != FieldState.Watered || _magicWordSaid != _magicWordNeeded) return; GD.Print("Trying to grow something here."); diff --git a/scripts/CSharp/Common/Inventory/ItemOnGround2D.cs b/scripts/CSharp/Common/Inventory/ItemOnGround2D.cs index bba4bb7..b313dae 100644 --- a/scripts/CSharp/Common/Inventory/ItemOnGround2D.cs +++ b/scripts/CSharp/Common/Inventory/ItemOnGround2D.cs @@ -6,9 +6,9 @@ public partial class ItemOnGround2D : Node { private ItemInstance _itemInstance; + [Export] public bool IsActive = true; [Export] private bool _infiniteSupply = false; [Export] private int _finiteSupply = 1; - [Export] public bool IsActive = true; private int pickUpCounter = 0; From b92eb909ad51594b2a3256b6fb2bce178990789e Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Thu, 17 Jul 2025 20:47:34 +0200 Subject: [PATCH 02/20] Removed no longer needed print statements --- scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs | 1 - scripts/CSharp/Common/Farming/FieldBehaviour2D.cs | 5 ----- scripts/CSharp/Common/Farming/PlantBehaviour2D.cs | 5 ----- 3 files changed, 11 deletions(-) diff --git a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs index 8200e85..5c741fe 100644 --- a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs +++ b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs @@ -42,7 +42,6 @@ public partial class InteractionArea2D : Node2D _label.Hide(); EmitSignal(SignalName.InteractedTool, _id); EmitSignal(SignalName.Interacted); - GD.Print("Interacted with: " + this.Name); } } diff --git a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs index 606d981..b52e0c4 100644 --- a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs +++ b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs @@ -40,27 +40,22 @@ public partial class FieldBehaviour2D : Sprite2D { case FieldState.Empty: FieldState = FieldState.Empty; - GD.Print("FieldState is Empty."); break; case FieldState.Tilled: FieldState = FieldState.Tilled; _fieldSprite.Texture = Tilled; _growingCollider.Visible = false; - GD.Print("FieldState is Tilled."); break; case FieldState.Watered: FieldState = FieldState.Watered; _fieldSprite.Texture = Watered; _growingCollider.Visible = true; - GD.Print("FieldState is Watered."); break; case FieldState.Planted: FieldState = FieldState.Planted; - GD.Print("FieldState is Planted."); break; default: FieldState = FieldState.NotFound; - GD.Print("FieldState is NotFound."); break; } } diff --git a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs index 267ee7d..f571d11 100644 --- a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs +++ b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs @@ -51,21 +51,18 @@ public partial class PlantBehaviour2D : Node2D _state = PlantState.Planted; _currentPlantSprite = GetRandomSprite(_seeds); _currentPlantSprite.Visible = true; - GD.Print("PlantState is none."); break; case PlantState.Planted: _state = PlantState.SmallPlant; _currentPlantSprite.Visible = false; _currentPlantSprite = GetRandomSprite(_smallPlants); _currentPlantSprite.Visible = true; - GD.Print("PlantState is planted."); break; case PlantState.SmallPlant: _state = PlantState.BigPlant; _currentPlantSprite.Visible = false; _currentPlantSprite = GetRandomSprite(_bigPlants); _currentPlantSprite.Visible = true; - GD.Print("PlantState is Smallplant."); break; case PlantState.BigPlant: _state = PlantState.Ready; @@ -73,7 +70,6 @@ public partial class PlantBehaviour2D : Node2D _currentPlantSprite = GetRandomSprite(_readyPlants); _harvestablePlant.IsActive = true; _currentPlantSprite.Visible = true; - GD.Print("PlantState is BigPlant."); break; case PlantState.Ready: _state = PlantState.None; @@ -96,7 +92,6 @@ public partial class PlantBehaviour2D : Node2D public void SayMagicWord(string wordEvent) { - GD.Print("Calling Dialogic event: " + wordEvent); if (_magicWordDialogicEventName != wordEvent) return; From 486cfb554631d3bf58fbad0ef264e09dfa06d8a0 Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Thu, 17 Jul 2025 22:10:08 +0200 Subject: [PATCH 03/20] WIP trying to fix the last plant stage bug on repeated farming rounds --- prefabs/farm/tomato_field.tscn | 3 +++ prefabs/farm/tomato_plant.tscn | 4 +++- .../CSharp/Common/Farming/PlantBehaviour2D.cs | 21 +++++++++++++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/prefabs/farm/tomato_field.tscn b/prefabs/farm/tomato_field.tscn index 32598bf..23aa8b2 100644 --- a/prefabs/farm/tomato_field.tscn +++ b/prefabs/farm/tomato_field.tscn @@ -43,6 +43,9 @@ text = "[E] Grow [node name="CollisionShape3D" parent="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"] shape = SubResource("CircleShape2D_l0vvv") +[node name="Label" parent="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem/PickupInteractionArea" index="1"] +text = "[E] Harvest" + [node name="MaskedField" type="Sprite2D" parent="FieldBehaviour"] clip_children = 1 scale = Vector2(1.5, 1.5) diff --git a/prefabs/farm/tomato_plant.tscn b/prefabs/farm/tomato_plant.tscn index 5e01f82..b52936d 100644 --- a/prefabs/farm/tomato_plant.tscn +++ b/prefabs/farm/tomato_plant.tscn @@ -104,7 +104,7 @@ region_enabled = true region_rect = Rect2(228, 600, 85, 92) [node name="BigPlant" type="Node2D" parent="."] -position = Vector2(0, -400) +position = Vector2(0, -300) [node name="01" type="Sprite2D" parent="BigPlant"] visible = false @@ -156,6 +156,8 @@ _blueprint = ExtResource("7_di4m0") [node name="ItemLabel" parent="ReadyPlantInventoryItem" index="1"] visible = false +z_index = 100 +text = "[E] harvest" [node name="PickupErrorLabel" parent="ReadyPlantInventoryItem" index="2"] visible = false diff --git a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs index f571d11..36ea630 100644 --- a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs +++ b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs @@ -42,9 +42,9 @@ public partial class PlantBehaviour2D : Node2D if (_field.FieldState != FieldState.Watered || _magicWordSaid != _magicWordNeeded) return; - GD.Print("Trying to grow something here."); GetTree().CallGroup("PlantGrowing", Player2D.MethodName.PlayFarmingAnimation); - + // todo: + // find out why the last plant stage is being skipped the second time around switch (_state) { case PlantState.None: @@ -68,13 +68,14 @@ public partial class PlantBehaviour2D : Node2D _state = PlantState.Ready; _currentPlantSprite.Visible = false; _currentPlantSprite = GetRandomSprite(_readyPlants); - _harvestablePlant.IsActive = true; _currentPlantSprite.Visible = true; + ActivatePickupAfterDelay(true); break; case PlantState.Ready: _state = PlantState.None; _currentPlantSprite.Visible = false; _currentPlantSprite = null; + ActivatePickupAfterDelay(false); break; default: break; @@ -89,7 +90,19 @@ public partial class PlantBehaviour2D : Node2D Random rand = new Random(); return sprites[rand.Next(sprites.Length)]; } - + + public async void ActivatePickupAfterDelay(bool activate) + { + await ToSignal(GetTree().CreateTimer(1.0f), "timeout"); + SetActiveHarvestablePlant(activate); + } + + private void SetActiveHarvestablePlant(bool active) + { + _harvestablePlant.IsActive = active; + _harvestablePlant.UpdateVisuals(); + } + public void SayMagicWord(string wordEvent) { if (_magicWordDialogicEventName != wordEvent) From ab23d41496305193a0f27101a9d8d9b71031803b Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Sat, 26 Jul 2025 16:51:05 +0200 Subject: [PATCH 04/20] Fixed ysorting on ducks and trash --- prefabs/Interactables/trash_object.tscn | 4 ++ prefabs/characters/Player2D.tscn | 2 +- prefabs/farm/duck.tscn | 42 ++++----------- scenes/Babushka_scene_farm_outside_2d.tscn | 37 +++++++++++++- ..._scene_farm_outside_2d_ducksCollected.tscn | 51 +++++++++++-------- 5 files changed, 80 insertions(+), 56 deletions(-) diff --git a/prefabs/Interactables/trash_object.tscn b/prefabs/Interactables/trash_object.tscn index dc1a121..aba551a 100644 --- a/prefabs/Interactables/trash_object.tscn +++ b/prefabs/Interactables/trash_object.tscn @@ -28,11 +28,15 @@ stream_8/stream = ExtResource("11_kb03l") stream_9/stream = ExtResource("12_kka6u") [node name="trashObject" type="Sprite2D"] +z_index = 1 +y_sort_enabled = true texture = ExtResource("1_k4ca3") +offset = Vector2(1, -215) region_enabled = true region_rect = Rect2(57, 493, 334, 475) [node name="InteractionArea" parent="." instance=ExtResource("2_gcgfd")] +position = Vector2(0, -172) [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] stream = SubResource("AudioStreamRandomizer_dich4") diff --git a/prefabs/characters/Player2D.tscn b/prefabs/characters/Player2D.tscn index 85a4dff..cf9fdf6 100644 --- a/prefabs/characters/Player2D.tscn +++ b/prefabs/characters/Player2D.tscn @@ -2065,7 +2065,7 @@ animations = [{ "speed": 11.0 }] -[node name="Player2d" type="Node2D" node_paths=PackedStringArray("_farmingControls", "_player2d")] +[node name="Vesna" type="Node2D" node_paths=PackedStringArray("_farmingControls", "_player2d")] y_sort_enabled = true script = ExtResource("1_yd5ep") _farmingControls = NodePath("FarmingControls") diff --git a/prefabs/farm/duck.tscn b/prefabs/farm/duck.tscn index 5c37de3..0756d6f 100644 --- a/prefabs/farm/duck.tscn +++ b/prefabs/farm/duck.tscn @@ -158,15 +158,11 @@ libraries = { } [node name="bodyLookingRight" type="Node2D" parent="."] -z_index = 1 -y_sort_enabled = true -position = Vector2(-5, -537) +position = Vector2(9.53674e-07, 0) rotation = 0.0135349 [node name="head" type="Sprite2D" parent="bodyLookingRight"] -z_index = 1 -y_sort_enabled = true -position = Vector2(46.9624, 76.1606) +position = Vector2(45.706, -451.714) rotation = 0.284615 scale = Vector2(1, 0.997) skew = 0.024546 @@ -176,8 +172,6 @@ region_enabled = true region_rect = Rect2(45, 24, 87, 82) [node name="beak upper" type="Sprite2D" parent="bodyLookingRight/head"] -z_index = 1 -y_sort_enabled = true position = Vector2(50.669, -7.16257) rotation = -0.0427724 scale = Vector2(0.62715, 0.62715) @@ -187,8 +181,6 @@ region_enabled = true region_rect = Rect2(292, 37, 152, 98) [node name="beak lower" type="Sprite2D" parent="bodyLookingRight/head"] -z_index = 1 -y_sort_enabled = true position = Vector2(47.9076, -15.7341) rotation = 0.0364142 scale = Vector2(0.58615, 0.58615) @@ -198,9 +190,7 @@ region_enabled = true region_rect = Rect2(295, 170, 145, 39) [node name="torso" type="Sprite2D" parent="bodyLookingRight"] -z_index = 1 -y_sort_enabled = true -position = Vector2(5.90997, 355.352) +position = Vector2(4.65357, -172.523) scale = Vector2(1.07526, 1.01724) texture = ExtResource("1_cgxhx") offset = Vector2(2.87376, -131.092) @@ -208,9 +198,7 @@ region_enabled = true region_rect = Rect2(30, 168, 125, 326) [node name="wingR" type="Sprite2D" parent="bodyLookingRight"] -z_index = 1 -y_sort_enabled = true -position = Vector2(-28, 262) +position = Vector2(-29.2564, -265.875) rotation = -0.371117 texture = ExtResource("1_cgxhx") offset = Vector2(-50, 50) @@ -218,9 +206,7 @@ region_enabled = true region_rect = Rect2(196, 231, 180, 164) [node name="wingL" type="Sprite2D" parent="bodyLookingRight"] -z_index = 1 -y_sort_enabled = true -position = Vector2(47.0695, 245.905) +position = Vector2(45.8131, -281.97) rotation = -0.0925884 skew = -0.0345086 texture = ExtResource("1_cgxhx") @@ -229,9 +215,7 @@ region_enabled = true region_rect = Rect2(196, 231, 180, 164) [node name="underbelly" type="Sprite2D" parent="bodyLookingRight"] -z_index = 1 -y_sort_enabled = true -position = Vector2(-11.4038, 439.203) +position = Vector2(-12.6602, -88.6718) rotation = -2.98225 scale = Vector2(0.672245, 0.955267) skew = 0.0185422 @@ -241,7 +225,7 @@ region_enabled = true region_rect = Rect2(196, 231, 180, 164) [node name="leg left" type="Sprite2D" parent="bodyLookingRight"] -position = Vector2(36.2887, 300.645) +position = Vector2(35.0323, -227.23) rotation = 2.42655 scale = Vector2(1.05221, 1.04106) skew = -0.0544101 @@ -283,9 +267,7 @@ region_enabled = true region_rect = Rect2(246, 393, 111, 111) [node name="right leg" type="Sprite2D" parent="bodyLookingRight"] -z_index = 1 -y_sort_enabled = true -position = Vector2(-24, 364) +position = Vector2(-25.2564, -163.875) rotation = -0.463741 scale = Vector2(1.07492, 1.01762) texture = ExtResource("1_cgxhx") @@ -293,8 +275,6 @@ region_enabled = true region_rect = Rect2(196, 231, 177, 161) [node name="right thigh" type="Sprite2D" parent="bodyLookingRight/right leg"] -z_index = 1 -y_sort_enabled = true position = Vector2(-29.7603, 44.2374) rotation = 0.249342 scale = Vector2(0.625107, 0.655894) @@ -304,8 +284,6 @@ region_enabled = true region_rect = Rect2(368, 263, 81, 89) [node name="right shin" type="Sprite2D" parent="bodyLookingRight/right leg/right thigh"] -z_index = 1 -y_sort_enabled = true position = Vector2(-2.78734, 11.5692) rotation = 0.0689206 scale = Vector2(1.12016, 1.07128) @@ -316,8 +294,6 @@ region_enabled = true region_rect = Rect2(360, 361, 68, 126) [node name="right foot" type="Sprite2D" parent="bodyLookingRight/right leg/right thigh/right shin"] -z_index = 1 -y_sort_enabled = true position = Vector2(-20.0986, 67.7507) rotation = 0.14855 scale = Vector2(1.212, 1.212) @@ -327,7 +303,7 @@ region_enabled = true region_rect = Rect2(246, 393, 111, 111) [node name="InteractionArea" parent="." instance=ExtResource("15_uo3dh")] -position = Vector2(-3, -274) +position = Vector2(18, -205) [node name="CollisionShape3D" parent="InteractionArea/Area2D" index="0"] shape = SubResource("CircleShape2D_uo3dh") diff --git a/scenes/Babushka_scene_farm_outside_2d.tscn b/scenes/Babushka_scene_farm_outside_2d.tscn index b48a256..9f70580 100644 --- a/scenes/Babushka_scene_farm_outside_2d.tscn +++ b/scenes/Babushka_scene_farm_outside_2d.tscn @@ -2133,34 +2133,48 @@ position = Vector2(-106.663, 182.891) shape = SubResource("RectangleShape2D_ycj14") [node name="ducks" type="Node2D" parent="YSorted"] +z_index = 1 +y_sort_enabled = true script = ExtResource("49_uxa2m") _goal = 6 [node name="Duck2" parent="YSorted/ducks" node_paths=PackedStringArray("_penTarget") instance=ExtResource("62_i36hd")] +z_index = 0 +y_sort_enabled = false position = Vector2(4374, 2652) _penTarget = NodePath("../../pen/penSlot1") [node name="Duck3" parent="YSorted/ducks" node_paths=PackedStringArray("_penTarget") instance=ExtResource("62_i36hd")] +z_index = 0 +y_sort_enabled = false position = Vector2(9259, 3194) _penTarget = NodePath("../../pen/penSlot2") [node name="Duck4" parent="YSorted/ducks" node_paths=PackedStringArray("_penTarget") instance=ExtResource("62_i36hd")] +z_index = 0 +y_sort_enabled = false position = Vector2(13441, 3612) rotation = 3.14159 scale = Vector2(1, -1) _penTarget = NodePath("../../pen/penSlot3") [node name="Duck5" parent="YSorted/ducks" node_paths=PackedStringArray("_penTarget") instance=ExtResource("62_i36hd")] +z_index = 0 +y_sort_enabled = false position = Vector2(15330, 2487) rotation = 3.14159 scale = Vector2(1, -1) _penTarget = NodePath("../../pen/penSlot4") [node name="Duck6" parent="YSorted/ducks" node_paths=PackedStringArray("_penTarget") instance=ExtResource("62_i36hd")] +z_index = 0 +y_sort_enabled = false position = Vector2(232, 2862) _penTarget = NodePath("../../pen/penSlot5") [node name="Duck7" parent="YSorted/ducks" node_paths=PackedStringArray("_penTarget") instance=ExtResource("62_i36hd")] +z_index = 0 +y_sort_enabled = false position = Vector2(2409, 3958) rotation = 3.14159 scale = Vector2(1, -1) @@ -2195,41 +2209,63 @@ position = Vector2(-4659, 2897) position = Vector2(-5016, 3361) [node name="trash" type="Node2D" parent="YSorted"] +z_index = 1 +y_sort_enabled = true [node name="trashObject" parent="YSorted/trash" instance=ExtResource("53_ycj14")] +z_index = 0 +y_sort_enabled = false position = Vector2(1269, 3170) [node name="trashObject2" parent="YSorted/trash" instance=ExtResource("53_ycj14")] +z_index = 0 +y_sort_enabled = false position = Vector2(3183, 2369) region_rect = Rect2(207, 1184, 149, 142) [node name="trashObject3" parent="YSorted/trash" instance=ExtResource("53_ycj14")] +z_index = 0 +y_sort_enabled = false position = Vector2(4724, 3519) region_rect = Rect2(400, 1053, 163, 141) [node name="trashObject4" parent="YSorted/trash" instance=ExtResource("53_ycj14")] +z_index = 0 +y_sort_enabled = false position = Vector2(5385, 3391) region_rect = Rect2(1048, 1092, 348, 106) [node name="trashObject5" parent="YSorted/trash" instance=ExtResource("53_ycj14")] +z_index = 0 +y_sort_enabled = false position = Vector2(8051, 2541) region_rect = Rect2(531, 1207, 176, 167) [node name="trashObject6" parent="YSorted/trash" instance=ExtResource("53_ycj14")] +z_index = 0 +y_sort_enabled = false position = Vector2(9629, 3312) region_rect = Rect2(207, 1184, 149, 142) [node name="trashObject7" parent="YSorted/trash" instance=ExtResource("53_ycj14")] +z_index = 0 +y_sort_enabled = false position = Vector2(12050, 3391) [node name="trashObject8" parent="YSorted/trash" instance=ExtResource("53_ycj14")] +z_index = 0 +y_sort_enabled = false position = Vector2(14589, 2505) rotation = 1.77025 +scale = Vector2(1, 1) region_rect = Rect2(629, 81, 227, 829) [node name="trashObject9" parent="YSorted/trash" instance=ExtResource("53_ycj14")] +z_index = 0 +y_sort_enabled = false position = Vector2(15197, 3447) rotation = 1.77025 +scale = Vector2(1, 1) region_rect = Rect2(1048, 1092, 348, 106) [node name="CanvasLayer" parent="." instance=ExtResource("32_2nee2")] @@ -2324,5 +2360,4 @@ script = ExtResource("40_w3jkj") [editable path="YSorted/ScytheGenericPickup/PickupInteractionArea"] [editable path="YSorted/ShovelGenericPickup"] [editable path="YSorted/ShovelGenericPickup/PickupInteractionArea"] -[editable path="YSorted/trash/trashObject"] [editable path="CanvasLayer"] diff --git a/scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn b/scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn index 7f158c4..a7e1dbc 100644 --- a/scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn +++ b/scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=100 format=3 uid="uid://cic8y0mdk3vd2"] +[gd_scene load_steps=103 format=3 uid="uid://cic8y0mdk3vd2"] [ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_gwe0p"] [ext_resource type="Script" uid="uid://bqomwxclsbhd3" path="res://scripts/CSharp/Common/Camera/CameraController.cs" id="2_1kqg8"] @@ -151,11 +151,23 @@ size = Vector2(1041, 368) resource_local_to_scene = true radius = 371.058 -[sub_resource type="CircleShape2D" id="CircleShape2D_2nee2"] +[sub_resource type="CircleShape2D" id="CircleShape2D_tkk2w"] resource_local_to_scene = true radius = 300.0 -[sub_resource type="CircleShape2D" id="CircleShape2D_ipqaa"] +[sub_resource type="CircleShape2D" id="CircleShape2D_gwe0p"] +resource_local_to_scene = true +radius = 300.0 + +[sub_resource type="CircleShape2D" id="CircleShape2D_1kqg8"] +resource_local_to_scene = true +radius = 300.0 + +[sub_resource type="CircleShape2D" id="CircleShape2D_6nf5r"] +resource_local_to_scene = true +radius = 300.0 + +[sub_resource type="CircleShape2D" id="CircleShape2D_2532c"] resource_local_to_scene = true radius = 300.0 @@ -1044,8 +1056,8 @@ position = Vector2(6095, 2087) [node name="SpawnWithItem" parent="YSorted/HoeGenericPickup" index="0"] _blueprint = ExtResource("34_n176s") -[node name="CollisionShape3D" parent="YSorted/HoeGenericPickup/InteractionArea2/Area2D" index="0"] -shape = SubResource("CircleShape2D_2nee2") +[node name="CollisionShape3D" parent="YSorted/HoeGenericPickup/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_tkk2w") [node name="CanGenericPickup" parent="YSorted" instance=ExtResource("33_tml8r")] position = Vector2(8192, 3507) @@ -1053,11 +1065,8 @@ position = Vector2(8192, 3507) [node name="SpawnWithItem" parent="YSorted/CanGenericPickup" index="0"] _blueprint = ExtResource("30_te7n5") -[node name="InteractionArea2" parent="YSorted/CanGenericPickup" index="3"] -position = Vector2(0, -159) - -[node name="CollisionShape3D" parent="YSorted/CanGenericPickup/InteractionArea2/Area2D" index="0"] -shape = SubResource("CircleShape2D_ipqaa") +[node name="CollisionShape3D" parent="YSorted/CanGenericPickup/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_gwe0p") [node name="RakeGenericPickup" parent="YSorted" instance=ExtResource("33_tml8r")] position = Vector2(8391, 2060) @@ -1065,8 +1074,8 @@ position = Vector2(8391, 2060) [node name="SpawnWithItem" parent="YSorted/RakeGenericPickup" index="0"] _blueprint = ExtResource("29_36k8l") -[node name="CollisionShape3D" parent="YSorted/RakeGenericPickup/InteractionArea2/Area2D" index="0"] -shape = SubResource("CircleShape2D_ipqaa") +[node name="CollisionShape3D" parent="YSorted/RakeGenericPickup/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_1kqg8") [node name="ScytheGenericPickup" parent="YSorted" instance=ExtResource("33_tml8r")] visible = false @@ -1075,8 +1084,8 @@ position = Vector2(15642, 2158) [node name="SpawnWithItem" parent="YSorted/ScytheGenericPickup" index="0"] _blueprint = ExtResource("35_p4sr7") -[node name="CollisionShape3D" parent="YSorted/ScytheGenericPickup/InteractionArea2/Area2D" index="0"] -shape = SubResource("CircleShape2D_ipqaa") +[node name="CollisionShape3D" parent="YSorted/ScytheGenericPickup/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_6nf5r") [node name="ShovelGenericPickup" parent="YSorted" instance=ExtResource("33_tml8r")] visible = false @@ -1085,8 +1094,8 @@ position = Vector2(5454, 2049) [node name="SpawnWithItem" parent="YSorted/ShovelGenericPickup" index="0"] _blueprint = ExtResource("36_vri5g") -[node name="CollisionShape3D" parent="YSorted/ShovelGenericPickup/InteractionArea2/Area2D" index="0"] -shape = SubResource("CircleShape2D_ipqaa") +[node name="CollisionShape3D" parent="YSorted/ShovelGenericPickup/PickupInteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_2532c") [node name="Farm visuals" type="Node2D" parent="YSorted"] position = Vector2(-60, 122) @@ -2259,13 +2268,13 @@ script = ExtResource("59_0knno") [editable path="YSorted/Vesna"] [editable path="YSorted/Brünnen/InteractionArea"] [editable path="YSorted/HoeGenericPickup"] -[editable path="YSorted/HoeGenericPickup/InteractionArea2"] +[editable path="YSorted/HoeGenericPickup/PickupInteractionArea"] [editable path="YSorted/CanGenericPickup"] -[editable path="YSorted/CanGenericPickup/InteractionArea2"] +[editable path="YSorted/CanGenericPickup/PickupInteractionArea"] [editable path="YSorted/RakeGenericPickup"] -[editable path="YSorted/RakeGenericPickup/InteractionArea2"] +[editable path="YSorted/RakeGenericPickup/PickupInteractionArea"] [editable path="YSorted/ScytheGenericPickup"] -[editable path="YSorted/ScytheGenericPickup/InteractionArea2"] +[editable path="YSorted/ScytheGenericPickup/PickupInteractionArea"] [editable path="YSorted/ShovelGenericPickup"] -[editable path="YSorted/ShovelGenericPickup/InteractionArea2"] +[editable path="YSorted/ShovelGenericPickup/PickupInteractionArea"] [editable path="CanvasLayer"] From 5ee295256b48e1f406bd7b6ced167773034a65c4 Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Sat, 26 Jul 2025 17:05:17 +0200 Subject: [PATCH 05/20] Fixed Yeli Layering issue in indoor scene --- project.godot | 5 ++--- scenes/Babushka_scene_indoor_common_room.tscn | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/project.godot b/project.godot index 305ff01..1e36fd7 100644 --- a/project.godot +++ b/project.godot @@ -108,9 +108,8 @@ glossary/glossary_files=["res://dialog/farming_equipment_glossary.tres"] [display] -window/size/viewport_width=2000 -window/size/viewport_height=1000 -window/size/always_on_top=true +window/size/viewport_width=1980 +window/size/viewport_height=1020 window/stretch/mode="viewport" window/stretch/aspect="keep_height" diff --git a/scenes/Babushka_scene_indoor_common_room.tscn b/scenes/Babushka_scene_indoor_common_room.tscn index ed67eef..5b5a308 100644 --- a/scenes/Babushka_scene_indoor_common_room.tscn +++ b/scenes/Babushka_scene_indoor_common_room.tscn @@ -215,6 +215,7 @@ resource_local_to_scene = true radius = 472.086 [node name="IndoorTest" type="Node2D"] +z_index = 1 y_sort_enabled = true script = ExtResource("1_3vr4f") _sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_indoor_vesnas_room.tscn", "res://scenes/Babushka_scene_farm_outside_2d_ducksCollected.tscn") @@ -515,9 +516,12 @@ region_rect = Rect2(2576, 802, 219, 64) position = Vector2(-4064, 244) [node name="Vesna" parent="." instance=ExtResource("15_7a68a")] +y_sort_enabled = false position = Vector2(-920, 319) [node name="Yeli" parent="." instance=ExtResource("16_dhsxs")] +z_index = 0 +y_sort_enabled = false position = Vector2(-1395, 16) _timelinesToPlay = PackedStringArray("yeli_intro_05") From ad16b861711b54d50605b3058e7074e35a836525 Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Sun, 27 Jul 2025 13:17:34 +0200 Subject: [PATCH 06/20] wip exchanging interaction label with outline --- art/animals/duck_flapFlap.res | Bin 888 -> 900 bytes art/materials/intaractable_outline.tres | 9 ++ prefabs/Interactables/trash_object.tscn | 9 +- prefabs/characters/Yeli.tscn | 16 ++-- prefabs/farm/duck.tscn | 79 ++++++++++-------- .../generic_item_on_ground_2d.tscn | 17 +--- prefabs/interactions/interaction_area_2d.tscn | 33 ++++++-- scenes/Babushka_scene_farm_outside_2d.tscn | 12 ++- scenes/Babushka_scene_indoor_common_room.tscn | 6 -- .../CharacterControls/InteractionArea2D.cs | 32 +++++-- shader/outline.gdshader | 73 ++++++++++++++++ shader/outline.gdshader.uid | 1 + 12 files changed, 203 insertions(+), 84 deletions(-) create mode 100644 art/materials/intaractable_outline.tres create mode 100644 shader/outline.gdshader create mode 100644 shader/outline.gdshader.uid diff --git a/art/animals/duck_flapFlap.res b/art/animals/duck_flapFlap.res index 89792f75fb9b39481801a01299b1ad29dbd07f04..80916bd31cc1d23e7c627196cb8ebd2e0988ed5f 100644 GIT binary patch literal 900 zcmV-~1AF{ZQ$s@n000005C8y)3;+OZ0{{RhwJ-f(i3=4Q0H)%8O3?B&9gsO@S;FZd zKH=h0I-V*VfGS7Ke8M3PTZEMbT21t}-|l9&vaL0#y?H=Y0o<0MdW(;?sEMHPPM8eG z10v7xj4(Xo50nC50AT=S0JH;Zq_A1MDMx1@}aCYlI z$%V4T{{#G$TP#Y%8mVZl5G=Gt|5Ki^y|1PmjLM?_DE~E_M?{SZl@T&<{2%#fX`U`R z{`?p4AHeAk+qP|+rfHg{X|NXW#IFOtxbtY>tvqko)o6|#wu`E~FDz#|87YDjXA-xF zrz`BRtl&shjmvx|csr9FT9@itTU(hmc5T-j3B1P!NtMm2Izd}i4dT+0-E!PHmohrm!1+YQkt52*gU8qp>fb)2FMB)5H)&ih{aF@ ziGeafN|Ip^bAowU;L>@9w@m$T5%bX$;>7=e&8PuoGBiS?ASp-+X$$}Zk)ciU5`fbb z2_gs*5h4TyOsT4zf&znN*bSG06xa-JT*EX8(p5SOVlo|3)BuuEjF1z=HuZ=pjRc`l zZQ8G5r)w!l|5m+~M`~vXOrGELaaUMO)pk<9)02EHUWXflEwCdFW{VHM6|iBxhDXcd z6^6UN*T66(|MqdBp#cpO{M+ZpBA50&(?{Sn`i7w*pkb94WrEQFt98A4c6hzpGh%e& zm_643oVC^hGcr+>Qwx>PG;l#kd-<#K0XRpum;^-lcLu@_J)9Sc9C0hly_dK36!A|B z@%ADBZbVuYOZ-9h@rd?@KmQ;DkmUGz7=qm(BDT&|15m3(I=U@g)Q}8{Gfs!1E z{y_KuVm!T}RA~yl05N2ZTTHY;vEP*IVCo&==fi)F=<{T;D3}_DcYj$0CGu2sz`9(g a5LI;!2LEt@;bT>FMUl711J9dMQ$s^F)1Ht3 literal 888 zcmV-;1Bd)lQ$s@n000005C8yW3;+ON0{{RhwJ-f(Wec?$0LEc_O3>0a9gsPO-2&w! zuqF=|QGL1+1BeVU^9hGI)G81)>epXB2F5$DhUky{#;JGg~x#eHw- zBF+}@aCYl|$bGWK{{dVmw^$U2HB!-9pI2yu{+s;QaGVe^C{9Gcu<`%&(b7C!blmwL z;J*mSAKSKVnx<)*roCFc6AK;q#hph3Z{>Nzu0eC`urs#TMNi)Ml{1@+6v2rziCe_e z6?RxwaHOinWxf-vz=FZx4XI-g8 zunaS@&Mf1ZWj8SYOZid^lHd1z-}iZ*=XsvjbzRqW9mjDT$8p=X1w23;fOuA`6{@Jn zD8r6UDhGvAG9@L+z;JV+bd!Y&pO?C!gG3D)A7UsJnF1ZRiD))iO^%n#i5uexmTfE) zCP+BZ%tVlJfuprj9)+mnjA&sJi|v3A0|WBF!HbKJ6e%EP?AQQ~6o@eh6A?lLV4##L z$|)!?NQT`QOBkRH0DKxP=Mscn-$`e)C`hx}jG{c-HE_W}Icp*#fY2FDtJk!~=PJ?8 zB2EP5lLGA7qDF)@i;w!IX$(vXDyVgB$xwIz^lzZqI2oz0*N27or-rhmBkv*j;p%&v z{?KOMT7i4Jh_6Ap6oJ?1biKeBR0+^B&yXkr`u;a|uY1eSbtTkM@Om!h9rzZ@A66oY z*nf3~WqkhV3`veOg<-r?{Kyi|-cha_!>J);@li0rjWP zM$(CPxPh=-?3synmg~f{5yFcPe;?6DiNj`NY98KIEvr?^B}ghs(3HA(vr4!bTzHkN OQ9x|=AignDQ$s_mE~n%G diff --git a/art/materials/intaractable_outline.tres b/art/materials/intaractable_outline.tres new file mode 100644 index 0000000..fe3cc01 --- /dev/null +++ b/art/materials/intaractable_outline.tres @@ -0,0 +1,9 @@ +[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://blch5kdhkbj75"] + +[ext_resource type="Shader" uid="uid://dsa3lv2as7q3b" path="res://shader/outline.gdshader" id="1_awyqf"] + +[resource] +shader = ExtResource("1_awyqf") +shader_parameter/allow_out_of_bounds = true +shader_parameter/outline_thickness = 8.0 +shader_parameter/outline_color = Color(0.88, 0.81664, 0.4576, 1) diff --git a/prefabs/Interactables/trash_object.tscn b/prefabs/Interactables/trash_object.tscn index aba551a..3a3133c 100644 --- a/prefabs/Interactables/trash_object.tscn +++ b/prefabs/Interactables/trash_object.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=15 format=3 uid="uid://sbf12hin4kes"] +[gd_scene load_steps=16 format=3 uid="uid://sbf12hin4kes"] [ext_resource type="Texture2D" uid="uid://bylgmr0skwtrs" path="res://art/farm/farming/farmobjekte/broken tools atlas.png" id="1_k4ca3"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="2_gcgfd"] +[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/intaractable_outline.tres" id="3_ic616"] [ext_resource type="AudioStream" uid="uid://be6g8b3v3u1ai" path="res://audio/sfx/Kitchen/SFX_Cooking_Knife_PickUp_01.wav" id="3_ktmp7"] [ext_resource type="AudioStream" uid="uid://cgjsajsdrrn0j" path="res://audio/sfx/Kitchen/SFX_Cooking_Knife_PutDown_01.wav" id="4_ic616"] [ext_resource type="AudioStream" uid="uid://br4drgupled6c" path="res://audio/sfx/Kitchen/SFX_Cooking_Pot_01.wav" id="5_dx175"] @@ -33,10 +34,12 @@ y_sort_enabled = true texture = ExtResource("1_k4ca3") offset = Vector2(1, -215) region_enabled = true -region_rect = Rect2(57, 493, 334, 475) +region_rect = Rect2(44, 479, 356, 503) -[node name="InteractionArea" parent="." instance=ExtResource("2_gcgfd")] +[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("2_gcgfd")] position = Vector2(0, -172) +_outlineMaterial = ExtResource("3_ic616") +_spriteToOutline = NodePath("..") [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] stream = SubResource("AudioStreamRandomizer_dich4") diff --git a/prefabs/characters/Yeli.tscn b/prefabs/characters/Yeli.tscn index bae482c..63e6254 100644 --- a/prefabs/characters/Yeli.tscn +++ b/prefabs/characters/Yeli.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=48 format=3 uid="uid://dfvgp1my5rydh"] +[gd_scene load_steps=49 format=3 uid="uid://dfvgp1my5rydh"] [ext_resource type="Texture2D" uid="uid://c34012j5ukiuf" path="res://art/animation/Yeli2D/F01-Yeli_Idle/0001.png" id="1_03m0b"] [ext_resource type="Script" uid="uid://d2486x6upmwqq" path="res://scripts/GdScript/dialogic_starter.gd" id="1_at1n1"] [ext_resource type="Script" uid="uid://d0kgxh4ykuv23" path="res://scripts/CSharp/Common/NPC/TalkingCharacter.cs" id="1_hn8at"] [ext_resource type="Texture2D" uid="uid://cksf38vypfsae" path="res://art/animation/Yeli2D/F01-Yeli_Idle/0002.png" id="2_hn8at"] [ext_resource type="Texture2D" uid="uid://e8dj27qcpuoo" path="res://art/animation/Yeli2D/F01-Yeli_Idle/0003.png" id="3_ahrat"] +[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/intaractable_outline.tres" id="3_pfk7p"] [ext_resource type="Texture2D" uid="uid://c5k63jgxqr0do" path="res://art/animation/Yeli2D/F01-Yeli_Idle/0004.png" id="4_at1n1"] [ext_resource type="Texture2D" uid="uid://b8lkbpi220b5h" path="res://art/animation/Yeli2D/F01-Yeli_Idle/0005.png" id="5_aqu1t"] [ext_resource type="Texture2D" uid="uid://bv5bxpx6vf2h0" path="res://art/animation/Yeli2D/F01-Yeli_Idle/0006.png" id="6_pfk7p"] @@ -192,22 +193,15 @@ y_sort_enabled = true script = ExtResource("1_hn8at") _sprite = NodePath("TalkingControl/AnimatedSprite") -[node name="InteractionArea" parent="." instance=ExtResource("42_ahrat")] +[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("42_ahrat")] position = Vector2(0, -450) scale = Vector2(2.805, 2.805) +_outlineMaterial = ExtResource("3_pfk7p") +_spriteToOutline = NodePath("../TalkingControl/AnimatedSprite") [node name="CollisionShape3D" parent="InteractionArea/Area2D" index="0"] shape = SubResource("CircleShape2D_at1n1") -[node name="Label" parent="InteractionArea" index="1"] -custom_minimum_size = Vector2(10, 10) -offset_left = -127.273 -offset_top = -245.633 -offset_right = 119.727 -offset_bottom = -142.633 -theme_override_font_sizes/font_size = 60 -text = "[E] talk" - [node name="TalkingControl" type="Node2D" parent="."] [node name="AnimatedSprite" type="AnimatedSprite2D" parent="TalkingControl"] diff --git a/prefabs/farm/duck.tscn b/prefabs/farm/duck.tscn index 0756d6f..ab54305 100644 --- a/prefabs/farm/duck.tscn +++ b/prefabs/farm/duck.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=3 uid="uid://muuxxgvx33fp"] +[gd_scene load_steps=25 format=3 uid="uid://muuxxgvx33fp"] [ext_resource type="Script" uid="uid://7m1rt7agb6rm" path="res://scripts/CSharp/Common/Temp/MVPDuck.cs" id="1_54k4r"] [ext_resource type="Texture2D" uid="uid://hvchk6t0xe7j" path="res://art/animals/Ente.png" id="1_cgxhx"] @@ -16,6 +16,7 @@ [ext_resource type="Animation" uid="uid://b3dwd88uvfk1k" path="res://art/animals/duck_flapFlap.res" id="14_uo3dh"] [ext_resource type="AudioStream" uid="uid://bsr5m8u2sle5k" path="res://audio/sfx/Animals/SFX_Duck_Wings_07.wav" id="14_xhefb"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="15_uo3dh"] +[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/intaractable_outline.tres" id="16_nxoeu"] [sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_sot7i"] streams_count = 4 @@ -39,7 +40,7 @@ length = 0.001 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("bodyLookingRight/wingR:rotation") +tracks/0/path = NodePath("SubViewport/bodyLookingRight/wingR:rotation") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { @@ -51,7 +52,7 @@ tracks/0/keys = { tracks/1/type = "value" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("bodyLookingRight/wingL:rotation") +tracks/1/path = NodePath("SubViewport/bodyLookingRight/wingL:rotation") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/keys = { @@ -63,7 +64,7 @@ tracks/1/keys = { tracks/2/type = "value" tracks/2/imported = false tracks/2/enabled = true -tracks/2/path = NodePath("bodyLookingRight/head:rotation") +tracks/2/path = NodePath("SubViewport/bodyLookingRight/head:rotation") tracks/2/interp = 1 tracks/2/loop_wrap = true tracks/2/keys = { @@ -75,7 +76,7 @@ tracks/2/keys = { tracks/3/type = "value" tracks/3/imported = false tracks/3/enabled = true -tracks/3/path = NodePath("bodyLookingRight/head/beak upper:rotation") +tracks/3/path = NodePath("SubViewport/bodyLookingRight/head/beak upper:rotation") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/keys = { @@ -87,7 +88,7 @@ tracks/3/keys = { tracks/4/type = "value" tracks/4/imported = false tracks/4/enabled = true -tracks/4/path = NodePath("bodyLookingRight/head/beak lower:rotation") +tracks/4/path = NodePath("SubViewport/bodyLookingRight/head/beak lower:rotation") tracks/4/interp = 1 tracks/4/loop_wrap = true tracks/4/keys = { @@ -135,6 +136,9 @@ _data = { resource_local_to_scene = true radius = 443.041 +[sub_resource type="ViewportTexture" id="ViewportTexture_4830j"] +viewport_path = NodePath("SubViewport") + [node name="Duck" type="Node2D" node_paths=PackedStringArray("_animationPlayer")] z_index = 1 y_sort_enabled = true @@ -157,11 +161,28 @@ libraries = { &"": SubResource("AnimationLibrary_54k4r") } -[node name="bodyLookingRight" type="Node2D" parent="."] -position = Vector2(9.53674e-07, 0) +[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("15_uo3dh")] +position = Vector2(18, -250) +_outlineMaterial = ExtResource("16_nxoeu") +_spriteToOutline = NodePath("../Duck rendered") + +[node name="CollisionShape3D" parent="InteractionArea/Area2D" index="0"] +shape = SubResource("CircleShape2D_uo3dh") + +[node name="Duck rendered" type="Sprite2D" parent="."] +position = Vector2(0, -250) +texture = SubResource("ViewportTexture_4830j") + +[node name="SubViewport" type="SubViewport" parent="."] +transparent_bg = true +size = Vector2i(400, 600) + +[node name="bodyLookingRight" type="Node2D" parent="SubViewport"] +position = Vector2(200, 550) rotation = 0.0135349 +scale = Vector2(1, 1) -[node name="head" type="Sprite2D" parent="bodyLookingRight"] +[node name="head" type="Sprite2D" parent="SubViewport/bodyLookingRight"] position = Vector2(45.706, -451.714) rotation = 0.284615 scale = Vector2(1, 0.997) @@ -171,7 +192,8 @@ offset = Vector2(25.2328, -23.0689) region_enabled = true region_rect = Rect2(45, 24, 87, 82) -[node name="beak upper" type="Sprite2D" parent="bodyLookingRight/head"] +[node name="beak upper" type="Sprite2D" parent="SubViewport/bodyLookingRight/head"] +z_index = 1 position = Vector2(50.669, -7.16257) rotation = -0.0427724 scale = Vector2(0.62715, 0.62715) @@ -180,7 +202,7 @@ offset = Vector2(57.1263, -7.47815) region_enabled = true region_rect = Rect2(292, 37, 152, 98) -[node name="beak lower" type="Sprite2D" parent="bodyLookingRight/head"] +[node name="beak lower" type="Sprite2D" parent="SubViewport/bodyLookingRight/head"] position = Vector2(47.9076, -15.7341) rotation = 0.0364142 scale = Vector2(0.58615, 0.58615) @@ -189,7 +211,7 @@ offset = Vector2(60.4601, 37.8134) region_enabled = true region_rect = Rect2(295, 170, 145, 39) -[node name="torso" type="Sprite2D" parent="bodyLookingRight"] +[node name="torso" type="Sprite2D" parent="SubViewport/bodyLookingRight"] position = Vector2(4.65357, -172.523) scale = Vector2(1.07526, 1.01724) texture = ExtResource("1_cgxhx") @@ -197,7 +219,7 @@ offset = Vector2(2.87376, -131.092) region_enabled = true region_rect = Rect2(30, 168, 125, 326) -[node name="wingR" type="Sprite2D" parent="bodyLookingRight"] +[node name="wingR" type="Sprite2D" parent="SubViewport/bodyLookingRight"] position = Vector2(-29.2564, -265.875) rotation = -0.371117 texture = ExtResource("1_cgxhx") @@ -205,7 +227,7 @@ offset = Vector2(-50, 50) region_enabled = true region_rect = Rect2(196, 231, 180, 164) -[node name="wingL" type="Sprite2D" parent="bodyLookingRight"] +[node name="wingL" type="Sprite2D" parent="SubViewport/bodyLookingRight"] position = Vector2(45.8131, -281.97) rotation = -0.0925884 skew = -0.0345086 @@ -214,7 +236,7 @@ offset = Vector2(-59.5924, 55.37) region_enabled = true region_rect = Rect2(196, 231, 180, 164) -[node name="underbelly" type="Sprite2D" parent="bodyLookingRight"] +[node name="underbelly" type="Sprite2D" parent="SubViewport/bodyLookingRight"] position = Vector2(-12.6602, -88.6718) rotation = -2.98225 scale = Vector2(0.672245, 0.955267) @@ -224,7 +246,7 @@ offset = Vector2(26.4135, 70.6083) region_enabled = true region_rect = Rect2(196, 231, 180, 164) -[node name="leg left" type="Sprite2D" parent="bodyLookingRight"] +[node name="leg left" type="Sprite2D" parent="SubViewport/bodyLookingRight"] position = Vector2(35.0323, -227.23) rotation = 2.42655 scale = Vector2(1.05221, 1.04106) @@ -233,7 +255,7 @@ texture = ExtResource("1_cgxhx") region_enabled = true region_rect = Rect2(196, 231, 177, 161) -[node name="left thigh" type="Sprite2D" parent="bodyLookingRight/leg left"] +[node name="left thigh" type="Sprite2D" parent="SubViewport/bodyLookingRight/leg left"] z_index = 1 y_sort_enabled = true position = Vector2(73.353, -69.771) @@ -243,7 +265,7 @@ texture = ExtResource("1_cgxhx") region_enabled = true region_rect = Rect2(368, 263, 81, 89) -[node name="left shin" type="Sprite2D" parent="bodyLookingRight/leg left/left thigh"] +[node name="left shin" type="Sprite2D" parent="SubViewport/bodyLookingRight/leg left/left thigh"] z_index = 1 y_sort_enabled = true position = Vector2(-5.71882, 19.9984) @@ -255,7 +277,7 @@ offset = Vector2(10, -50) region_enabled = true region_rect = Rect2(360, 361, 68, 126) -[node name="left foot" type="Sprite2D" parent="bodyLookingRight/leg left/left thigh/left shin"] +[node name="left foot" type="Sprite2D" parent="SubViewport/bodyLookingRight/leg left/left thigh/left shin"] z_index = 1 y_sort_enabled = true position = Vector2(15.1289, -77.6075) @@ -266,7 +288,7 @@ offset = Vector2(40, 40) region_enabled = true region_rect = Rect2(246, 393, 111, 111) -[node name="right leg" type="Sprite2D" parent="bodyLookingRight"] +[node name="right leg" type="Sprite2D" parent="SubViewport/bodyLookingRight"] position = Vector2(-25.2564, -163.875) rotation = -0.463741 scale = Vector2(1.07492, 1.01762) @@ -274,7 +296,7 @@ texture = ExtResource("1_cgxhx") region_enabled = true region_rect = Rect2(196, 231, 177, 161) -[node name="right thigh" type="Sprite2D" parent="bodyLookingRight/right leg"] +[node name="right thigh" type="Sprite2D" parent="SubViewport/bodyLookingRight/right leg"] position = Vector2(-29.7603, 44.2374) rotation = 0.249342 scale = Vector2(0.625107, 0.655894) @@ -283,7 +305,7 @@ texture = ExtResource("1_cgxhx") region_enabled = true region_rect = Rect2(368, 263, 81, 89) -[node name="right shin" type="Sprite2D" parent="bodyLookingRight/right leg/right thigh"] +[node name="right shin" type="Sprite2D" parent="SubViewport/bodyLookingRight/right leg/right thigh"] position = Vector2(-2.78734, 11.5692) rotation = 0.0689206 scale = Vector2(1.12016, 1.07128) @@ -293,7 +315,7 @@ offset = Vector2(-14.163, 37.0936) region_enabled = true region_rect = Rect2(360, 361, 68, 126) -[node name="right foot" type="Sprite2D" parent="bodyLookingRight/right leg/right thigh/right shin"] +[node name="right foot" type="Sprite2D" parent="SubViewport/bodyLookingRight/right leg/right thigh/right shin"] position = Vector2(-20.0986, 67.7507) rotation = 0.14855 scale = Vector2(1.212, 1.212) @@ -302,17 +324,6 @@ offset = Vector2(40, 40) region_enabled = true region_rect = Rect2(246, 393, 111, 111) -[node name="InteractionArea" parent="." instance=ExtResource("15_uo3dh")] -position = Vector2(18, -205) - -[node name="CollisionShape3D" parent="InteractionArea/Area2D" index="0"] -shape = SubResource("CircleShape2D_uo3dh") - -[node name="Label" parent="InteractionArea" index="1"] -modulate = Color(0, 0, 0, 1) -z_index = 1 -y_sort_enabled = true - [connection signal="Interacted" from="InteractionArea" to="." method="TransferToTargetAfterDelay"] [connection signal="Interacted" from="InteractionArea" to="Audio/NakNak" method="PlayOneShot"] diff --git a/prefabs/interactions/generic_item_on_ground_2d.tscn b/prefabs/interactions/generic_item_on_ground_2d.tscn index 472bd23..452c748 100644 --- a/prefabs/interactions/generic_item_on_ground_2d.tscn +++ b/prefabs/interactions/generic_item_on_ground_2d.tscn @@ -2,6 +2,7 @@ [ext_resource type="Script" uid="uid://btusf04xnywhm" path="res://scripts/CSharp/Common/Inventory/ItemOnGround2D.cs" id="1_tlhp6"] [ext_resource type="Script" uid="uid://c8suoi3i6kqai" path="res://scripts/CSharp/Common/Inventory/ItemOnGroundSpawnWith.cs" id="3_xu8me"] +[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/intaractable_outline.tres" id="4_harr4"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="4_xu8me"] [ext_resource type="Texture2D" uid="uid://cfxibry711o16" path="res://art/ui/UI/icons/icon-scythe.png" id="5_harr4"] @@ -15,9 +16,6 @@ default_font_size = 40 resource_local_to_scene = true radius = 300.0 -[sub_resource type="Theme" id="Theme_xu8me"] -default_font_size = 75 - [node name="GenericItemOnGround" type="Node2D"] script = ExtResource("1_tlhp6") @@ -43,20 +41,13 @@ theme = SubResource("Theme_harr4") text = "thewe waf a pwoblem wiph picking up te item UWU" autowrap_mode = 3 -[node name="PickupInteractionArea" parent="." instance=ExtResource("4_xu8me")] +[node name="PickupInteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("4_xu8me")] +_outlineMaterial = ExtResource("4_harr4") +_spriteToOutline = NodePath("../Icon") [node name="CollisionShape3D" parent="PickupInteractionArea/Area2D" index="0"] shape = SubResource("CircleShape2D_tlhp6") -[node name="Label" parent="PickupInteractionArea" index="1"] -z_index = 5 -offset_left = -68.0 -offset_top = -111.0 -offset_right = 75.0 -offset_bottom = -3.0 -theme = SubResource("Theme_xu8me") -vertical_alignment = 1 - [node name="Icon" type="Sprite2D" parent="."] position = Vector2(5, -300) scale = Vector2(0.868852, 0.868852) diff --git a/prefabs/interactions/interaction_area_2d.tscn b/prefabs/interactions/interaction_area_2d.tscn index 4796490..aabd043 100644 --- a/prefabs/interactions/interaction_area_2d.tscn +++ b/prefabs/interactions/interaction_area_2d.tscn @@ -7,12 +7,12 @@ resource_local_to_scene = true radius = 300.0 [sub_resource type="Theme" id="Theme_5ajrf"] -default_font_size = 75 +default_font_size = 30 [node name="InteractionArea" type="Node2D" node_paths=PackedStringArray("_area", "_label")] script = ExtResource("1_5ajrf") _area = NodePath("Area2D") -_label = NodePath("Label") +_label = NodePath("Area2D/CanvasLayer/MarginContainer/Label") [node name="Area2D" type="Area2D" parent="."] collision_mask = 4 @@ -20,15 +20,32 @@ collision_mask = 4 [node name="CollisionShape3D" type="CollisionShape2D" parent="Area2D"] shape = SubResource("CircleShape2D_npluf") -[node name="Label" type="Label" parent="."] +[node name="CanvasLayer" type="CanvasLayer" parent="Area2D"] + +[node name="MarginContainer" type="MarginContainer" parent="Area2D/CanvasLayer"] +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -88.0 +offset_top = -100.0 +offset_right = 3.0 +offset_bottom = 3.0 +grow_horizontal = 0 +grow_vertical = 0 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 + +[node name="Label" type="Label" parent="Area2D/CanvasLayer/MarginContainer"] visible = false -offset_left = -46.0 -offset_top = -55.0 -offset_right = 45.0 -offset_bottom = 48.0 +layout_mode = 2 +size_flags_horizontal = 8 +size_flags_vertical = 8 theme = SubResource("Theme_5ajrf") text = "[E]" -horizontal_alignment = 1 +horizontal_alignment = 2 +vertical_alignment = 2 [connection signal="body_entered" from="Area2D" to="." method="OnPlayerEntered"] [connection signal="body_exited" from="Area2D" to="." method="OnPlayerExited"] diff --git a/scenes/Babushka_scene_farm_outside_2d.tscn b/scenes/Babushka_scene_farm_outside_2d.tscn index 9f70580..a788d7f 100644 --- a/scenes/Babushka_scene_farm_outside_2d.tscn +++ b/scenes/Babushka_scene_farm_outside_2d.tscn @@ -1127,6 +1127,8 @@ polygon = PackedVector2Array(247.227, 43.5123, 44.7822, 43.5123, -87.2178, 45.12 [node name="EnterHouseInteraction" parent="YSorted/Farm visuals/Static" instance=ExtResource("27_klb81")] position = Vector2(5839, 2349) scale = Vector2(2.425, 2.425) +_useOutline = false +_useSprite = false _id = 0 [node name="greenery" type="Node2D" parent="YSorted/Farm visuals/Static"] @@ -2221,30 +2223,35 @@ position = Vector2(1269, 3170) z_index = 0 y_sort_enabled = false position = Vector2(3183, 2369) +offset = Vector2(1, -50) region_rect = Rect2(207, 1184, 149, 142) [node name="trashObject3" parent="YSorted/trash" instance=ExtResource("53_ycj14")] z_index = 0 y_sort_enabled = false position = Vector2(4724, 3519) +offset = Vector2(1, -50) region_rect = Rect2(400, 1053, 163, 141) [node name="trashObject4" parent="YSorted/trash" instance=ExtResource("53_ycj14")] z_index = 0 y_sort_enabled = false position = Vector2(5385, 3391) +offset = Vector2(1, -50) region_rect = Rect2(1048, 1092, 348, 106) [node name="trashObject5" parent="YSorted/trash" instance=ExtResource("53_ycj14")] z_index = 0 y_sort_enabled = false position = Vector2(8051, 2541) +offset = Vector2(1, -50) region_rect = Rect2(531, 1207, 176, 167) [node name="trashObject6" parent="YSorted/trash" instance=ExtResource("53_ycj14")] z_index = 0 y_sort_enabled = false position = Vector2(9629, 3312) +offset = Vector2(1, -50) region_rect = Rect2(207, 1184, 149, 142) [node name="trashObject7" parent="YSorted/trash" instance=ExtResource("53_ycj14")] @@ -2257,15 +2264,14 @@ z_index = 0 y_sort_enabled = false position = Vector2(14589, 2505) rotation = 1.77025 -scale = Vector2(1, 1) region_rect = Rect2(629, 81, 227, 829) [node name="trashObject9" parent="YSorted/trash" instance=ExtResource("53_ycj14")] z_index = 0 y_sort_enabled = false -position = Vector2(15197, 3447) +position = Vector2(15322, 3472) rotation = 1.77025 -scale = Vector2(1, 1) +offset = Vector2(0, 0) region_rect = Rect2(1048, 1092, 348, 106) [node name="CanvasLayer" parent="." instance=ExtResource("32_2nee2")] diff --git a/scenes/Babushka_scene_indoor_common_room.tscn b/scenes/Babushka_scene_indoor_common_room.tscn index 5b5a308..2947cb4 100644 --- a/scenes/Babushka_scene_indoor_common_room.tscn +++ b/scenes/Babushka_scene_indoor_common_room.tscn @@ -529,12 +529,6 @@ _timelinesToPlay = PackedStringArray("yeli_intro_05") position = Vector2(-207.487, 136.185) shape = SubResource("CircleShape2D_wuntg") -[node name="Label" parent="Yeli/InteractionArea" index="1"] -offset_left = -332.62 -offset_top = -99.8217 -offset_right = -85.6204 -offset_bottom = 3.17825 - [node name="AnimatedSprite" parent="Yeli/TalkingControl" index="0"] position = Vector2(-576, 368) diff --git a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs index 5c741fe..6e5187f 100644 --- a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs +++ b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs @@ -6,15 +6,25 @@ public partial class InteractionArea2D : Node2D { [Export] private Area2D _area; [Export] private Label _label; - [Export] private SpriteSwitcher2D _sprites; // TODO: remove + [Export] private bool _useOutline = true; + [Export] private ShaderMaterial _outlineMaterial; + [Export] private bool _useSprite = true; + [Export] private CanvasItem _spriteToOutline; [Export] private bool _showLabel = true; [Export] private int _id = -1; // TODO: remove + private Material _backupMaterial; [Signal] public delegate void InteractedToolEventHandler(int id); // TODO: remove [Signal] public delegate void InteractedEventHandler(); public bool IsActive { get; set; } = true; + public override void _Ready() + { + if(_useSprite && _useOutline) + _backupMaterial = _spriteToOutline.Material; + } + public void OnPlayerEntered(Node2D player) { if (!IsActive) @@ -22,6 +32,11 @@ public partial class InteractionArea2D : Node2D if(_showLabel) _label.Show(); + + if (!_useSprite || !_useOutline) + return; + + _spriteToOutline.Material = _outlineMaterial; } public void OnPlayerExited(Node2D player) @@ -30,6 +45,11 @@ public partial class InteractionArea2D : Node2D return; _label.Hide(); + + if (!_useSprite || !_useOutline) + return; + + _spriteToOutline.Material = _backupMaterial; } public override void _Input(InputEvent @event) @@ -40,6 +60,10 @@ public partial class InteractionArea2D : Node2D if (@event.IsAction("interact") && @event.IsPressed() && _area.HasOverlappingBodies()) { _label.Hide(); + + if (_useSprite && _useOutline) + _spriteToOutline.Material = _backupMaterial; + EmitSignal(SignalName.InteractedTool, _id); EmitSignal(SignalName.Interacted); } @@ -47,13 +71,9 @@ public partial class InteractionArea2D : Node2D public void SetSpriteActiveState(bool success, int id) // TODO: remove { + GD.PrintErr("SetSpriteActiveState is being called."); if(!IsActive) return; - - if (_id == id) - { - _sprites.SwitchState(!success); - } } public void ToggleActive() diff --git a/shader/outline.gdshader b/shader/outline.gdshader new file mode 100644 index 0000000..356dea2 --- /dev/null +++ b/shader/outline.gdshader @@ -0,0 +1,73 @@ +shader_type canvas_item; + +uniform bool allow_out_of_bounds = true; +uniform float outline_thickness: hint_range(0.0, 16.0, 1.0) = 1.0; +uniform vec4 outline_color: source_color = vec4(1.0); + +bool is_inside_usquare(vec2 x) { + return x == clamp(x, vec2(0.0), vec2(1.0)); +} + +vec4 blend(vec4 bottom, vec4 top) { + float alpha = top.a + bottom.a * (1.0 - top.a); + if (alpha < 0.0001) return vec4(0.0); + + vec3 color = mix(bottom.rgb * bottom.a, top.rgb, top.a) / alpha; + return vec4(color, alpha); +} + +void vertex() { + if (allow_out_of_bounds) VERTEX += (UV * 2.0 - 1.0) * outline_thickness; +} + +void fragment() { + if (outline_thickness > 0.0 && outline_color.a > 0.0) { + vec2 uv = UV; + vec4 texture_color = texture(TEXTURE, UV); + + if (allow_out_of_bounds) { + vec2 texture_pixel_size = vec2(1.0) / (vec2(1.0) / TEXTURE_PIXEL_SIZE + vec2(outline_thickness * 2.0)); + uv = (uv - texture_pixel_size * outline_thickness) * TEXTURE_PIXEL_SIZE / texture_pixel_size; + + if (is_inside_usquare(uv)) { + texture_color = texture(TEXTURE, uv); + } else { + texture_color = vec4(0.0); + } + } + + float alpha = 0.0; + + for (float y = 1.0; y <= outline_thickness; y++) { + for (float x = 0.0; x <= y; x++) { + if (length(vec2(x, y - 0.5)) > outline_thickness) break; + + float look_at_alpha; + vec2 look_at_uv[8] = { + uv + vec2(x, y) * TEXTURE_PIXEL_SIZE, + uv + vec2(-x, y) * TEXTURE_PIXEL_SIZE, + uv + vec2(x, -y) * TEXTURE_PIXEL_SIZE, + uv + vec2(-x, -y) * TEXTURE_PIXEL_SIZE, + uv + vec2(y, x) * TEXTURE_PIXEL_SIZE, + uv + vec2(-y, x) * TEXTURE_PIXEL_SIZE, + uv + vec2(y, -x) * TEXTURE_PIXEL_SIZE, + uv + vec2(-y, -x) * TEXTURE_PIXEL_SIZE + }; + + for (int i = 0; i < 8; i++) { + if (is_inside_usquare(look_at_uv[i])) { + look_at_alpha = texture(TEXTURE, look_at_uv[i]).a; + if (look_at_alpha > alpha) alpha = look_at_alpha; + if (1.0 - alpha < 0.0001) break; + } + } + + if (1.0 - alpha < 0.0001) break; + } + + if (1.0 - alpha < 0.0001) break; + } + + COLOR = blend(vec4(outline_color.rgb, alpha * outline_color.a), texture_color); + } +} diff --git a/shader/outline.gdshader.uid b/shader/outline.gdshader.uid new file mode 100644 index 0000000..a195e00 --- /dev/null +++ b/shader/outline.gdshader.uid @@ -0,0 +1 @@ +uid://dsa3lv2as7q3b From cfe604d3b7e65107571861317402e574b72f8d2c Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Thu, 31 Jul 2025 18:55:06 +0200 Subject: [PATCH 07/20] set duck body scale to 1,1 --- prefabs/farm/duck.tscn | 1 - 1 file changed, 1 deletion(-) diff --git a/prefabs/farm/duck.tscn b/prefabs/farm/duck.tscn index ab54305..e731648 100644 --- a/prefabs/farm/duck.tscn +++ b/prefabs/farm/duck.tscn @@ -180,7 +180,6 @@ size = Vector2i(400, 600) [node name="bodyLookingRight" type="Node2D" parent="SubViewport"] position = Vector2(200, 550) rotation = 0.0135349 -scale = Vector2(1, 1) [node name="head" type="Sprite2D" parent="SubViewport/bodyLookingRight"] position = Vector2(45.706, -451.714) From 730c4999d7ce55ab26f2ce05f76966a4d2767000 Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Thu, 31 Jul 2025 20:35:14 +0200 Subject: [PATCH 08/20] Extracted FightAttack Enum in the hopes of fixing errors --- scripts/CSharp/Common/Farming/FieldBehaviour2D.cs | 9 --------- scripts/CSharp/Common/Farming/FieldState.cs | 13 +++++++++++++ scripts/CSharp/Common/Farming/PlantBehaviour2D.cs | 9 +-------- scripts/CSharp/Common/Farming/PlantState.cs | 13 +++++++++++++ scripts/CSharp/Common/Fight/FightAttack.cs | 9 +++++++++ scripts/CSharp/Common/Fight/FightInstance.cs | 8 +------- 6 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 scripts/CSharp/Common/Farming/FieldState.cs create mode 100644 scripts/CSharp/Common/Farming/PlantState.cs create mode 100644 scripts/CSharp/Common/Fight/FightAttack.cs diff --git a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs index b52e0c4..b747ebf 100644 --- a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs +++ b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs @@ -4,15 +4,6 @@ using Godot; namespace Babushka.scripts.CSharp.Common.Farming; -public enum FieldState -{ - Empty = 0, - Tilled = 1, - Planted = 2, - Watered = 3, - NotFound = 99 -} - [GlobalClass] public partial class FieldBehaviour2D : Sprite2D { diff --git a/scripts/CSharp/Common/Farming/FieldState.cs b/scripts/CSharp/Common/Farming/FieldState.cs new file mode 100644 index 0000000..b489bb8 --- /dev/null +++ b/scripts/CSharp/Common/Farming/FieldState.cs @@ -0,0 +1,13 @@ +namespace Babushka.scripts.CSharp.Common.Farming; + +/// +/// State of a farm field. +/// +public enum FieldState +{ + Empty = 0, + Tilled = 1, + Planted = 2, + Watered = 3, + NotFound = 99 +} \ No newline at end of file diff --git a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs index 36ea630..96f8fcd 100644 --- a/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs +++ b/scripts/CSharp/Common/Farming/PlantBehaviour2D.cs @@ -5,14 +5,7 @@ using Godot; namespace Babushka.scripts.CSharp.Common.Farming; -public enum PlantState -{ - None = 0, - Planted = 1, - SmallPlant = 2, - BigPlant = 3, - Ready = 4 -} + /// /// Determines the behaviour of a plant in Babushka. diff --git a/scripts/CSharp/Common/Farming/PlantState.cs b/scripts/CSharp/Common/Farming/PlantState.cs new file mode 100644 index 0000000..7019625 --- /dev/null +++ b/scripts/CSharp/Common/Farming/PlantState.cs @@ -0,0 +1,13 @@ +namespace Babushka.scripts.CSharp.Common.Farming; + +/// +/// State of a harvestable plant. Used in farming. +/// +public enum PlantState +{ + None = 0, + Planted = 1, + SmallPlant = 2, + BigPlant = 3, + Ready = 4 +} \ No newline at end of file diff --git a/scripts/CSharp/Common/Fight/FightAttack.cs b/scripts/CSharp/Common/Fight/FightAttack.cs new file mode 100644 index 0000000..0c1248f --- /dev/null +++ b/scripts/CSharp/Common/Fight/FightAttack.cs @@ -0,0 +1,9 @@ +namespace Babushka.scripts.CSharp.Common.Fight; + +public class FightAttack +{ + public int damage; + public bool needsSelectedTarget; + public Fighter? target; + public Fighter attacker; +} \ No newline at end of file diff --git a/scripts/CSharp/Common/Fight/FightInstance.cs b/scripts/CSharp/Common/Fight/FightInstance.cs index ff5eb89..28d608f 100644 --- a/scripts/CSharp/Common/Fight/FightInstance.cs +++ b/scripts/CSharp/Common/Fight/FightInstance.cs @@ -348,10 +348,4 @@ public partial class FightInstance : Node2D //TODO: remake return false; } } -public class FightAttack -{ - public int damage; - public bool needsSelectedTarget; - public Fighter? target; - public Fighter attacker; -} + From 19e30dd0b8d1d117f1a11ac05b900e41443fb44f Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Thu, 31 Jul 2025 20:35:49 +0200 Subject: [PATCH 09/20] Removed disclaimer reference from bootstrap --- scenes/Babushka_scene_bootstrap.tscn | 1 + 1 file changed, 1 insertion(+) diff --git a/scenes/Babushka_scene_bootstrap.tscn b/scenes/Babushka_scene_bootstrap.tscn index 5b1809d..6ae60a7 100644 --- a/scenes/Babushka_scene_bootstrap.tscn +++ b/scenes/Babushka_scene_bootstrap.tscn @@ -5,5 +5,6 @@ [node name="BabushkaSceneBootstrap" type="Node2D"] [node name="BabushkaSceneStartMenu" parent="." instance=ExtResource("1_15ton")] +_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_farm_outside_2d.tscn") [node name="SceneParent" type="Node" parent="."] From 0f246825fc9654c5f690580d60d540ff49f35adc Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Thu, 31 Jul 2025 20:36:17 +0200 Subject: [PATCH 10/20] Added Wellbehaviour and fixed door interaction to offer outlines --- art/farm/Babushka_house_frontDoor.png | Bin 0 -> 4052 bytes art/farm/Babushka_house_frontDoor.png.import | 34 +++++++++++++ scenes/Babushka_scene_farm_outside_2d.tscn | 25 ++++++--- .../CharacterControls/InteractionArea2D.cs | 48 +++++++++++++----- .../CSharp/Common/Farming/FieldState.cs.uid | 1 + .../CSharp/Common/Farming/PlantState.cs.uid | 1 + .../CSharp/Common/Farming/WateringCanState.cs | 6 +++ .../CSharp/Common/Farming/WellBehaviour.cs | 19 +++++++ .../Common/Farming/WellBehaviour.cs.uid | 1 + .../CSharp/Common/Fight/FightAttack.cs.uid | 1 + 10 files changed, 116 insertions(+), 20 deletions(-) create mode 100644 art/farm/Babushka_house_frontDoor.png create mode 100644 art/farm/Babushka_house_frontDoor.png.import create mode 100644 scripts/CSharp/Common/Farming/FieldState.cs.uid create mode 100644 scripts/CSharp/Common/Farming/PlantState.cs.uid create mode 100644 scripts/CSharp/Common/Farming/WellBehaviour.cs create mode 100644 scripts/CSharp/Common/Farming/WellBehaviour.cs.uid create mode 100644 scripts/CSharp/Common/Fight/FightAttack.cs.uid diff --git a/art/farm/Babushka_house_frontDoor.png b/art/farm/Babushka_house_frontDoor.png new file mode 100644 index 0000000000000000000000000000000000000000..f8378f872bdad82655e2596379e818bcf4dbead8 GIT binary patch literal 4052 zcmV;_4=eDAP)YB=Q+Wz9{h%o;7uYV!Xrfq0VL-79X z*H9Z{bT+ij8i6qgiVAHH%**e}={vEXS@7U6ALDn12c@Q2uEnuQ8}4CWY5v*tLi?f7Y{7|^ z|36+cdylgTBYP1w{WA=Jr-t^E-Stn$5IILq|Hu6A?%84LuW9>0>c2RioL%`qxkxk!j3Alpo=P&T_pFhBx5AT^oN!y31E5O|jzWL>M?I6OcB)f+P zxM>G*et7|#cHy|&-OUzmw>RDUtFOLlLBEM2zbzNtUSGr6#RXJ#9kefO3HZy$pWynZ zPjGg1$pZ{aNe|mC{QGZzhpUza*~KCXw;8)@DY|JvXeql6uxL%Q>p7O~tL?{fj2Nxi zHQkQ|$f2m^M`6!ROe^|n&R$<{l^|5c1O>!=!fZeG6$13PxMdSF+8|QjbV?id0Y-Zt zV`ZTPB~df!5fpeq8i*W*LL}TBdEwEx4k9?m=pLMcQq*Dy6hA&m@(HX6C2AOfK`?3T zp(kmMi!eZ(TRCw7A>F<28ajy*v6&1#b^8}SvMLzIgFx2M8kmc7K#M9MP~sK zBgY^)zDuP*kmOYyA5+ztV{}N9H18-BHI*C???-aR4{=fih5So+K&8b&WZWZS1xDv| z7i98C;kgA-M3Ys%Ur$NmE=mYUZmxv%nrK{uB0NC|9YbaeB-6+At~`B%*gc;a*a}qg z6XEE`Vdof9Y<(64BOPQ(-1kw zuVV;mM(TYJ!Y%kk36Zk)43L5Bz{o{sr`Or_S%^_ytE9IQFtF!S8Iyz|#0m@w7&vp- z56Mzc0WOS=v=Nv2Fzz5gs{zVC_0a*3?@RYYJhNNJqh` zED57!a3(e5%nlAOSg084O}$4qQ6dqeD7|%25Ld#k;t_gny}RYE0zF;(N!vPjlxKjo zla7G`fFM;Y1i%p@N?cqbW(<^Akz-AOU|=H3aIy;FQi$H;^(cd&ZLM&`a2!M1>Nyoc zh`f^gxNb?RZfCAe#b}jdXnQ0}RtXF$c*SJqmo;}4i(a@~L}nj5VXO8L7ciz`{~F%6 zZpP#pQ{%`nq@#5(Z#!8!N__aoTrwJ9c@~7W)oN3m%4aW16c8(C8C|V;*1Zzk8^eNN zE-QU7Mf;~%2bVSuQKHDmf?u!}na3y!X8@}N6J&uX+zoe;dCXDyEQSHnw1z%smN*|v z0U4B9!U)v5R#3WUqG4tc;zb3dV*pV?QRq4UwGwBQcH5ovgrm{PAW=9aL&Yx%5sIce zW)oIf8JL6@jf&zK-hI037~0k^!q@|K@-RvYZ`=pj5av_*5EGFmlr$z>MG1-Tu3~B0 zp%gAigMqa@Hch;U&E4~22E9-`pw##~?2(fP|&S zXfx5Q=Tmc6wTWSHL)F}C!% zuW=uT?8(BI^8%5uwF>^x{?73jjk?8G4M#$Dj)5;iTx#;SbXc>eDB@7cQL;d*nBRm- zLIt-d$x3N2mv11yC;=^lkPF*j%|uf*Fb_~*h;8>wEfOlIXPl71S!xMmWxOk|h&7$2 zDDo}YW<|dkuA)UrNg^yvsihdABzST?tszq|n!TFL5#BM@gd*;hB#sLgV37Kgb6^>0 zxPhUqL`XX77)q#xS*vQ5h~qQXRGLttM8UCY_7#9*V4me1OM?coms%pP`jEOhiRu`* z(s+#01eI(&9EK4kg3-Cc6Bozz8AV;QxvQv|Xo>R*S!B=<+K1e=#KnmV)!E7oMbnzA zK9Rd7<-z2v*HGdUTDB-rwzNiIC_&^QT}8 z&?~zigG6h6svwC!r_M2-dM;XsK4l%_rVH7Bf4A%M>ljVpp;LXlV z6XTBQHg^XX(YkSw5W9#{`)kzUxRg%d_><(8IsA=H8|N0TIuBK;gc00J;Zo7v+JG+2tQ$K|Y z`0B&AaDH{^2@p(#S&RUcJ}j^A&vg^6cA~VGIQXqsbbAZi&tD!>zjcg#`gt)ocEWZ| z-;YheHBU^O1=a8V^anV9bH$+dlw_~^tz%*ZU@35q>Qd#iN(Psi)@EC`^*lKaIUQVb zd&Nr8sWf-xlNlF>isP79Nhdb=`>ZfbaC5>F$mS=#o}~7 z3kYkO*w@Nl^8_;^YTA2hg{YTuV~Wl(TFO3aP0G#1#iP&bi!=E3_rG6kyYE_1Y_Gp` z=G4X271W!}(+}NVXRQ-eGQx4Ipni>FwQ$*)FR@fJY|RUVvBIS0 zewznnK~fqxSValRL0Y9q8WP1gV?qsqT(n;%9V3bokZ+0kc$@;gOnsx|QpO{or{~io zGa%`tw3w?z>4Vb!q~_2u{i?$VfrC+$NM(jmP==8T@}kKSua@5Nnjt|*$Hr9#t3pq3 zBv_nHWl9Rosnk**&aab|gSk4@LEtl2rH~|T6%(Ktwc^!n9pG<{T)aF!b z={Y%q2Eo*|SK*ZBLi0-4F`*RZrn1r|%e zke1vuZnvc1tezrpr*igIq01NcX|)S2+XQ2xOjn7r?(Q+)=MyD@D>iYAd<6@xq+d6e zxD+@jS87c_sSgpsg_5Jd{HQgJ=fO_T;Exi|R{ByAqx1!$NqsQd5*8(*JE4lgFt|YE z2gbg5Xl9LK8jrHt=X3xet?YQsVr<8i(3fMv5vb3)FgkG8F(^kW#&xU`k1XlM$?6KH z6jhBij!r`!V>V?^9meZ2#vw-@I>G6}DU>@7FNdnF{2;hAN)ls+IeeV{N) zh0l*c`xja>EK&+jTmcx<$t%&Ll)~c?4I?lxJ%UpkDLiL3=?p7);7% z-X6~gX%P{bAx?!;PCrDQ_*gPrB#NU5q%vE%r>!hN@s}Ik_HA_Pse7bzr#jCh6+#$g$Z+3rFZpH4)f zaQX(7Vr?<-Dz{@P$nTWy7jX;H)sfIKSU3hQECveBF-kC30oFkTURDW)TrP>TO6Uk2 zr5&HKJ)fMwkn%BvR&-M$)HwN7+y!8zkuG{Lbc}+V=|fU8(Zoj?cbv=>bxJkv!uc`c zRR#ubU<6K4EGkeZR-P_09^oy%p+FhKA%U`(e9EVc-Q5KoBj&xSmB2w!#HW19tI(R; z6s8%&oz#rdi^bnrI_04$uE=B)B~oG}e+NQ*uILeFkj}9b!Ds47$<+ww$WzQZAcpZE zo4q2PW083*sxX2roWh&C8iBIJz)@Ps4B`|exg6?|z&Jve-e!|J&Ki9dnixiB7BN9V zO#{tt=QQ8W+wNgEe^3Mx7~4{z*a#uMG6>OO9uj|u^3sK3)>=lMm`{tYs;;5hZ2B{` zR?T2B0Z~G+I_`ACuTSYA zL`??{Y=1iW#H=XJ`H+2hV-U_N0~_1l5R=(7G`)ZEgwla=LVK=wTp2qIG#oENM^3lA zex%ZIjEBWo`+3FF8W0{C7rIH#+nXEMJ?y&qeCnbxVE_L`ib2}xR-#7$0000 _active; + set => _active = value; + } + public override void _Ready() { - if(_useSprite && _useOutline) - _backupMaterial = _spriteToOutline.Material; + if (_useSprite && _useOutline) + { + try + { + _backupMaterial = _spriteToOutline.Material; + } + catch(Exception exception) + { + GD.PrintErr($"No sprite to outline found on: {GetParent().Name}" + exception.Message); + } + } + } public void OnPlayerEntered(Node2D player) { - if (!IsActive) + if (!_active) return; if(_showLabel) @@ -41,7 +58,7 @@ public partial class InteractionArea2D : Node2D public void OnPlayerExited(Node2D player) { - if (!IsActive) + if (!_active) return; _label.Hide(); @@ -54,31 +71,34 @@ public partial class InteractionArea2D : Node2D public override void _Input(InputEvent @event) { - if (!IsActive) + if (!_active) return; - if (@event.IsAction("interact") && @event.IsPressed() && _area.HasOverlappingBodies()) + if (@event.IsAction("interact") && @event.IsPressed()) { - _label.Hide(); + if (_area.HasOverlappingBodies()) + { + _label.Hide(); - if (_useSprite && _useOutline) - _spriteToOutline.Material = _backupMaterial; + if (_useSprite && _useOutline) + _spriteToOutline.Material = _backupMaterial; - EmitSignal(SignalName.InteractedTool, _id); - EmitSignal(SignalName.Interacted); + EmitSignal(SignalName.InteractedTool, _id); + EmitSignal(SignalName.Interacted); + } } } public void SetSpriteActiveState(bool success, int id) // TODO: remove { GD.PrintErr("SetSpriteActiveState is being called."); - if(!IsActive) + if(!_active) return; } public void ToggleActive() { - IsActive = !IsActive; + _active = !_active; _label.Hide(); } } \ No newline at end of file diff --git a/scripts/CSharp/Common/Farming/FieldState.cs.uid b/scripts/CSharp/Common/Farming/FieldState.cs.uid new file mode 100644 index 0000000..2f0fe65 --- /dev/null +++ b/scripts/CSharp/Common/Farming/FieldState.cs.uid @@ -0,0 +1 @@ +uid://cqtlic8xxtvkc diff --git a/scripts/CSharp/Common/Farming/PlantState.cs.uid b/scripts/CSharp/Common/Farming/PlantState.cs.uid new file mode 100644 index 0000000..714ae0d --- /dev/null +++ b/scripts/CSharp/Common/Farming/PlantState.cs.uid @@ -0,0 +1 @@ +uid://dw5dl5yscbyaw diff --git a/scripts/CSharp/Common/Farming/WateringCanState.cs b/scripts/CSharp/Common/Farming/WateringCanState.cs index 8e4e89c..333a44d 100644 --- a/scripts/CSharp/Common/Farming/WateringCanState.cs +++ b/scripts/CSharp/Common/Farming/WateringCanState.cs @@ -23,6 +23,10 @@ public static class WateringCanState /// Triggers animations and ui. /// public static bool Active = false; + + public delegate void WateringCanDelegate(bool state); + public static event WateringCanDelegate WateringCanActiveStateChanged; + /// @@ -65,6 +69,8 @@ public static class WateringCanState /// public static void SetActive(bool active) { + if(active != Active) + WateringCanActiveStateChanged?.Invoke(active); Active = active; } } \ No newline at end of file diff --git a/scripts/CSharp/Common/Farming/WellBehaviour.cs b/scripts/CSharp/Common/Farming/WellBehaviour.cs new file mode 100644 index 0000000..51b2958 --- /dev/null +++ b/scripts/CSharp/Common/Farming/WellBehaviour.cs @@ -0,0 +1,19 @@ +using Babushka.scripts.CSharp.Common.CharacterControls; +using Godot; + +namespace Babushka.scripts.CSharp.Common.Farming; + +public partial class WellBehaviour : Node2D +{ + [Export] private InteractionArea2D _interactionArea; + + public override void _Ready() + { + WateringCanState.WateringCanActiveStateChanged += OnWateringCanStateChanged; + } + + private void OnWateringCanStateChanged(bool state) + { + _interactionArea.IsActive = state; + } +} \ No newline at end of file diff --git a/scripts/CSharp/Common/Farming/WellBehaviour.cs.uid b/scripts/CSharp/Common/Farming/WellBehaviour.cs.uid new file mode 100644 index 0000000..cec2b49 --- /dev/null +++ b/scripts/CSharp/Common/Farming/WellBehaviour.cs.uid @@ -0,0 +1 @@ +uid://boehox1ydbcnx diff --git a/scripts/CSharp/Common/Fight/FightAttack.cs.uid b/scripts/CSharp/Common/Fight/FightAttack.cs.uid new file mode 100644 index 0000000..5744876 --- /dev/null +++ b/scripts/CSharp/Common/Fight/FightAttack.cs.uid @@ -0,0 +1 @@ +uid://cnggo5jyimosu From 18711776bb64138884963973ba3944b2f43235be Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Thu, 31 Jul 2025 21:44:17 +0200 Subject: [PATCH 11/20] Fixed output error ERROR: Script class can only be set together with base class name --- scripts/CSharp/Common/Animation/AnimationStarter.cs | 5 +++-- scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs | 1 + scripts/CSharp/Common/Farming/FieldService2D.cs | 2 +- scripts/CSharp/Common/Quest/QuestMessagePopup.cs | 1 - scripts/CSharp/Common/SpriteSwitcher2D.cs | 1 + 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/CSharp/Common/Animation/AnimationStarter.cs b/scripts/CSharp/Common/Animation/AnimationStarter.cs index e3d8974..7b53485 100644 --- a/scripts/CSharp/Common/Animation/AnimationStarter.cs +++ b/scripts/CSharp/Common/Animation/AnimationStarter.cs @@ -1,5 +1,6 @@ using Godot; -using System; + +namespace Babushka.scripts.CSharp.Common.Animation; public partial class AnimationStarter : Node2D { @@ -21,4 +22,4 @@ public partial class AnimationStarter : Node2D _played = true; } -} +} \ No newline at end of file diff --git a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs index 13278fa..72ea54b 100644 --- a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs +++ b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs @@ -28,6 +28,7 @@ public partial class InteractionArea2D : Node2D public override void _Ready() { + if (_useSprite && _useOutline) { try diff --git a/scripts/CSharp/Common/Farming/FieldService2D.cs b/scripts/CSharp/Common/Farming/FieldService2D.cs index 5b36976..0583dbd 100644 --- a/scripts/CSharp/Common/Farming/FieldService2D.cs +++ b/scripts/CSharp/Common/Farming/FieldService2D.cs @@ -6,7 +6,7 @@ namespace Babushka.scripts.CSharp.Common.Farming; [GlobalClass] public partial class FieldService2D : Node2D { - [Export] private Dictionary fields = new Dictionary(); + [Export] private Dictionary fields; [Export] private Area2D _allowedArea; diff --git a/scripts/CSharp/Common/Quest/QuestMessagePopup.cs b/scripts/CSharp/Common/Quest/QuestMessagePopup.cs index 5999c41..4f0e76a 100644 --- a/scripts/CSharp/Common/Quest/QuestMessagePopup.cs +++ b/scripts/CSharp/Common/Quest/QuestMessagePopup.cs @@ -5,7 +5,6 @@ using Babushka.scripts.CSharp.Common.Quest; public partial class QuestMessagePopup : Control { - private Label Text => GetNode