Compare commits

...

4 Commits

Author SHA1 Message Date
kziolkowski e1b1a2f447 🔧 adjusted seed pickup positions and indoor collider sizes 2025-10-24 15:57:14 +02:00
kziolkowski 2d4e853ec8 🍱 Adjusted colliders in farm_outside scene and reactivated ground collider on Vesna 2025-10-24 15:45:10 +02:00
kziolkowski 8f097de476 :memo::fire:🔨
- removed a lot of unnecessary code
- Made a minimal working version
- Added documentation
2025-10-24 15:13:35 +02:00
kziolkowski 0e55394699 🚧 WIP first setup completed (still buggy!) 2025-10-22 19:30:33 +02:00
18 changed files with 180 additions and 18 deletions
+1
View File
@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArea2D_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fefbd3244e8e427e388f389cc304f90548d56b58a375097a197ac2eb8259990bb_003FArea2D_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArea3D_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F8a54226fa2e1c9371a8091f24cfd744aef11fe6869527dc23b9b837623a29b9_003FArea3D_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAudioStreamPlayer2D_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F848324b1c23114c3f5e8bbb5a42c4ade394c59a7a7a133a66b76581ca571_003FAudioStreamPlayer2D_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABabushka_002Escripts_002ECSharp_002ECommon_002EFarming_002EFieldBehaviour2D_005FScriptMethods_002Egenerated_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F75d11718f1abbc2572fd32e4b83acbec9d79ac_003FBabushka_002Escripts_002ECSharp_002ECommon_002EFarming_002EFieldBehaviour2D_005FScriptMethods_002Egenerated_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
+6 -2
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=481 format=3 uid="uid://c25udixd5m6l0"]
[gd_scene load_steps=482 format=3 uid="uid://c25udixd5m6l0"]
[ext_resource type="Script" uid="uid://b05uyj001ehwi" path="res://scripts/CSharp/Common/Farming/VesnaBehaviour2D.cs" id="1_yd5ep"]
[ext_resource type="Script" uid="uid://cjbclkxesh3hc" path="res://scripts/CSharp/Common/CharacterControls/PlayerMovement.cs" id="2_1vqmv"]
@@ -270,6 +270,7 @@
[ext_resource type="Texture2D" uid="uid://cw68t2kbcvlen" path="res://art/animation/Vesna2D/Vesna Anims Tools/F01-Idle-Gießkanne/0004.png" id="460_6b7gh"]
[ext_resource type="Texture2D" uid="uid://dh3cfbcqm0fs4" path="res://art/animation/Vesna2D/Vesna Anims Tools/F01-Idle-Gießkanne/0006.png" id="462_6yyoj"]
[ext_resource type="Texture2D" uid="uid://vahac0df0dhj" path="res://art/animation/Vesna2D/Vesna Anims Tools/F01-Idle-Gießkanne/0008.png" id="464_pbc3r"]
[ext_resource type="PackedScene" uid="uid://pflu0uaig7vv" path="res://prefabs/interactions/detection_cross.tscn" id="466_e04c3"]
[ext_resource type="Texture2D" uid="uid://b37lpqrsjjuc0" path="res://art/animation/Vesna2D/Vesna Anims Tools/F01-Idle-Gießkanne/0010.png" id="466_pw1ip"]
[ext_resource type="Script" uid="uid://er03dkj8axlr" path="res://scripts/CSharp/Common/UI/WateringCanUi.cs" id="467_j4m0f"]
[ext_resource type="Texture2D" uid="uid://oi11ax6tml6j" path="res://art/animation/Vesna2D/Vesna Anims Tools/F01-Idle-Gießkanne/0012.png" id="468_08021"]
@@ -2096,7 +2097,6 @@ script = ExtResource("2_1vqmv")
_stepTimer = NodePath("../SFX/FootstepsAudio/Timer")
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
visible = false
z_index = 1
y_sort_enabled = true
position = Vector2(-24, -13)
@@ -2139,6 +2139,9 @@ step = 0.0
editable = false
scrollable = false
[node name="DetectionCross" parent="CharacterBody2D" instance=ExtResource("466_e04c3")]
position = Vector2(0, -200)
[node name="FarmingControls" type="Node2D" parent="." node_paths=PackedStringArray("_movingPlayer", "_wateringParticles")]
script = ExtResource("817_6nrw3")
_fieldPrefab = ExtResource("818_16w6h")
@@ -2188,6 +2191,7 @@ wait_time = 0.5
[connection signal="InventorySelectionChanged" from="." to="CharacterBody2D/WateringCanUI" method="IsWateringCanActive"]
[connection signal="PickedUpTool" from="." to="CharacterBody2D/visuals" method="ActivateTool"]
[connection signal="PickedUpTool" from="." to="CharacterBody2D/WateringCanUI" method="IsWateringCanActive"]
[connection signal="LookDirection" from="CharacterBody2D/visuals" to="CharacterBody2D/DetectionCross" method="SetDirection"]
[connection signal="WateringField" from="FarmingControls" to="CharacterBody2D/visuals" method="PlayWateringAnimation"]
[connection signal="WateringField" from="FarmingControls" to="CharacterBody2D/WateringCanUI" method="Water"]
[connection signal="timelineEnded" from="dialogic toggle" to="." method="EnableMovement"]
+1 -2
View File
@@ -53,7 +53,7 @@
[sub_resource type="CircleShape2D" id="CircleShape2D_at1n1"]
resource_local_to_scene = true
radius = 300.0
radius = 500.0
[sub_resource type="SpriteFrames" id="SpriteFrames_f6hss"]
animations = [{
@@ -208,7 +208,6 @@ _sprite = NodePath("TalkingControl/AnimatedSprite")
[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("42_ahrat")]
position = Vector2(0, -450)
scale = Vector2(2.805, 2.805)
_spriteToOutline = NodePath("../TalkingControl/AnimatedSprite")
[node name="CollisionShape3D" parent="InteractionArea/Area2D" index="0"]
+1 -1
View File
@@ -133,7 +133,7 @@ _data = {
[sub_resource type="CircleShape2D" id="CircleShape2D_uo3dh"]
resource_local_to_scene = true
radius = 443.041
radius = 200.0
[sub_resource type="ViewportTexture" id="ViewportTexture_4830j"]
viewport_path = NodePath("SubViewport")
+12
View File
@@ -0,0 +1,12 @@
[gd_scene load_steps=3 format=3 uid="uid://pflu0uaig7vv"]
[ext_resource type="Script" uid="uid://ccc6m6c5khd2x" path="res://scripts/CSharp/Common/CharacterControls/DetectionCross.cs" id="1_va8tx"]
[ext_resource type="PackedScene" uid="uid://dugr6ff1g7hi0" path="res://prefabs/interactions/detector.tscn" id="2_8hh05"]
[node name="DetectionCross" type="Node2D" node_paths=PackedStringArray("_detector")]
script = ExtResource("1_va8tx")
_detector = NodePath("detector")
_xOffset = 300.0
_yOffset = 300.0
[node name="detector" parent="." instance=ExtResource("2_8hh05")]
+14
View File
@@ -0,0 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://dugr6ff1g7hi0"]
[ext_resource type="Script" uid="uid://c3pd60biootsx" path="res://scripts/CSharp/Common/CharacterControls/Detector.cs" id="1_6pib0"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qwv4c"]
size = Vector2(100, 200)
[node name="detector" type="Area2D"]
collision_layer = 4
script = ExtResource("1_6pib0")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_qwv4c")
debug_color = Color(0.9459047, 7.2196126e-06, 0.5925879, 0.41960785)
@@ -63,7 +63,6 @@ _spriteToOutline = NodePath("../Icon")
shape = SubResource("CircleShape2D_tlhp6")
[node name="Icon" type="Sprite2D" parent="."]
position = Vector2(5, -300)
scale = Vector2(0.868852, 0.868852)
texture = ExtResource("5_harr4")
@@ -1,11 +1,12 @@
[gd_scene load_steps=5 format=3 uid="uid://cqc72e4hq6bcd"]
[gd_scene load_steps=6 format=3 uid="uid://cqc72e4hq6bcd"]
[ext_resource type="Script" uid="uid://ckp413wrub5fm" path="res://scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs" id="1_5ajrf"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/simple_interactable_outline.tres" id="2_qoey7"]
[ext_resource type="Script" uid="uid://cp2q4k62sjo6h" path="res://scripts/CSharp/Common/CharacterControls/DetectableInteractionArea.cs" id="3_2wrrq"]
[sub_resource type="CircleShape2D" id="CircleShape2D_npluf"]
resource_local_to_scene = true
radius = 300.0
radius = 150.0
[sub_resource type="Theme" id="Theme_5ajrf"]
default_font_size = 30
@@ -18,6 +19,7 @@ _outlineMaterial = ExtResource("2_qoey7")
[node name="Area2D" type="Area2D" parent="."]
collision_mask = 4
script = ExtResource("3_2wrrq")
[node name="CollisionShape3D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_npluf")
@@ -49,5 +51,5 @@ text = "[E]"
horizontal_alignment = 2
vertical_alignment = 2
[connection signal="body_entered" from="Area2D" to="." method="OnPlayerEntered"]
[connection signal="body_exited" from="Area2D" to="." method="OnPlayerExited"]
[connection signal="area_entered" from="Area2D" to="." method="OnPlayerEntered"]
[connection signal="area_exited" from="Area2D" to="." method="OnPlayerExited"]
+19 -3
View File
@@ -171,7 +171,7 @@ radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_tm0yg"]
resource_local_to_scene = true
radius = 300.0
radius = 200.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_lhtpe"]
@@ -1091,7 +1091,7 @@ _blueprint = ExtResource("28_6b2nr")
shape = SubResource("CircleShape2D_tm0yg")
[node name="SeedPickup" parent="YSorted" instance=ExtResource("25_hukxv")]
position = Vector2(10114, 2469)
position = Vector2(9927, 2257)
_infiniteSupply = true
_finiteSupply = 3
@@ -1109,7 +1109,7 @@ texture = ExtResource("36_l7ekk")
region_enabled = true
[node name="SeedPickup2" parent="YSorted" instance=ExtResource("25_hukxv")]
position = Vector2(10892, 2469)
position = Vector2(10705, 2257)
_finiteSupply = 3
[node name="SpawnWithItem" parent="YSorted/SeedPickup2" index="0"]
@@ -2247,6 +2247,9 @@ position = Vector2(3183, 2369)
offset = Vector2(1, -50)
region_rect = Rect2(207, 1184, 149, 142)
[node name="InteractionArea" parent="YSorted/trash/trashObject2" index="0"]
position = Vector2(-9, -46)
[node name="trashObject3" parent="YSorted/trash" instance=ExtResource("53_ycj14")]
z_index = 0
y_sort_enabled = false
@@ -2254,6 +2257,9 @@ position = Vector2(4724, 3519)
offset = Vector2(1, -50)
region_rect = Rect2(400, 1053, 163, 141)
[node name="InteractionArea" parent="YSorted/trash/trashObject3" index="0"]
position = Vector2(-13, -53)
[node name="trashObject4" parent="YSorted/trash" instance=ExtResource("53_ycj14")]
z_index = 0
y_sort_enabled = false
@@ -2261,6 +2267,9 @@ position = Vector2(5385, 3391)
offset = Vector2(1, -50)
region_rect = Rect2(1048, 1092, 348, 106)
[node name="InteractionArea" parent="YSorted/trash/trashObject4" index="0"]
position = Vector2(0, -59)
[node name="trashObject5" parent="YSorted/trash" instance=ExtResource("53_ycj14")]
z_index = 0
y_sort_enabled = false
@@ -2295,6 +2304,9 @@ rotation = 1.77025
offset = Vector2(0, 0)
region_rect = Rect2(1048, 1092, 348, 106)
[node name="InteractionArea" parent="YSorted/trash/trashObject9" index="0"]
position = Vector2(22.40873, 25.05658)
[node name="CanvasLayer" parent="." instance=ExtResource("32_2nee2")]
[node name="Inventory" parent="CanvasLayer" index="1"]
@@ -2440,4 +2452,8 @@ timeline = "quest2_tomatoes_end"
[editable path="YSorted/SeedPickup/PickupInteractionArea"]
[editable path="YSorted/SeedPickup2"]
[editable path="YSorted/SeedPickup2/PickupInteractionArea"]
[editable path="YSorted/trash/trashObject2"]
[editable path="YSorted/trash/trashObject3"]
[editable path="YSorted/trash/trashObject4"]
[editable path="YSorted/trash/trashObject9"]
[editable path="CanvasLayer"]
@@ -38,7 +38,7 @@ size = Vector2(3836, 1086)
[sub_resource type="CircleShape2D" id="CircleShape2D_yd2gv"]
resource_local_to_scene = true
radius = 472.086
radius = 300.0
[sub_resource type="CircleShape2D" id="CircleShape2D_gpagp"]
resource_local_to_scene = true
@@ -212,7 +212,7 @@ _data = {
[sub_resource type="CircleShape2D" id="CircleShape2D_wuntg"]
resource_local_to_scene = true
radius = 209.703
radius = 400.0
[node name="IndoorTest" type="Node2D"]
z_index = 1
@@ -311,6 +311,7 @@ region_rect = Rect2(3161, 313, 679, 1050)
[node name="OutsideDoor" parent="BackWall/Room01DorrR" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("11_gpagp")]
position = Vector2(-7, 248)
scale = Vector2(1.5, 1.5)
_spriteToOutline = NodePath("..")
_id = 1
@@ -358,7 +359,7 @@ region_enabled = true
region_rect = Rect2(2360, 864, 356, 251)
[node name="InteractionArea" parent="BackWall/Room01PechkaDoor" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("11_gpagp")]
scale = Vector2(1.8, 1.96)
position = Vector2(0, -3)
_spriteToOutline = NodePath("..")
[node name="CollisionShape3D" parent="BackWall/Room01PechkaDoor/InteractionArea/Area2D" index="0"]
@@ -541,8 +542,11 @@ y_sort_enabled = false
position = Vector2(-1395, 16)
_timelinesToPlay = PackedStringArray("yeli_intro_05")
[node name="InteractionArea" parent="Yeli" index="0"]
position = Vector2(-373, -63)
[node name="CollisionShape3D" parent="Yeli/InteractionArea/Area2D" index="0"]
position = Vector2(-207.487, 136.185)
position = Vector2(-225.99994, 33)
shape = SubResource("CircleShape2D_wuntg")
[node name="AnimatedSprite" parent="Yeli/TalkingControl" index="0"]
@@ -14,6 +14,11 @@ public partial class VesnaAnimations : Node
private string _toolString;
private int _toolID = -1; // -1 means no tool.
private Vector2 _lastDirection = Vector2.Zero;
/// <summary>
/// Emits the last look direction of the player to other scripts.
/// </summary>
[Signal] public delegate void LookDirectionEventHandler(Vector2 direction);
public override void _Ready()
{
@@ -89,6 +94,8 @@ public partial class VesnaAnimations : Node
}
*/
EmitSignal(SignalName.LookDirection, _lastDirection);
if (anyActionPressed)
{
_sprite.Play();
@@ -0,0 +1,10 @@
using Godot;
namespace Babushka.scripts.CSharp.Common.CharacterControls;
/// <summary>
/// Used for identifying <see cref="InteractionArea2D"/> scenes when listening for area overlaps.
/// </summary>
public partial class DetectableInteractionArea : Area2D
{
}
@@ -0,0 +1 @@
uid://cp2q4k62sjo6h
@@ -0,0 +1,22 @@
using Godot;
namespace Babushka.scripts.CSharp.Common.CharacterControls;
/// <summary>
/// Moves the Detector to the position in accordance with the player view to limit the player's range of actions to the ones in front of them.
/// </summary>
public partial class DetectionCross : Node2D
{
[Export] private Detector _detector;
[Export] private float _xOffset;
[Export] private float _yOffset;
/// <summary>
/// Gets the current look direction of the player and moves the detection shape with it.
/// </summary>
/// <param name="direction"></param>
public void SetDirection(Vector2 direction)
{
_detector.Position = new Vector2(direction.X * _xOffset, direction.Y * _yOffset);
}
}
@@ -0,0 +1 @@
uid://ccc6m6c5khd2x
@@ -0,0 +1,69 @@
using Babushka.scripts.CSharp.Common.Services;
using Godot;
namespace Babushka.scripts.CSharp.Common.CharacterControls;
/// <summary>
/// Defines an <see cref="Area2D"/> Node with a <see cref="CollisionShape2D"/> used for detecting <see cref="InteractionArea2D"/> nodes.
/// </summary>
public partial class Detector : Area2D
{
[Export] private bool _active = true;
/// <summary>
/// Called when entering an interactionArea node.
/// </summary>
[Signal] public delegate void InteractableEnteredEventHandler();
/// <summary>
/// Called when exiting an interactionArea node.
/// </summary>
[Signal] public delegate void InteractableExitedEventHandler();
public bool IsActive
{
get => _active;
set
{
Visible = value;
_active = value;
}
}
public override void _Ready()
{
AreaEntered += OnEnteredInteractable;
AreaExited += OnExitedInteractable;
}
/// <summary>
/// Called every time this node enters an Area2D.
/// </summary>
/// <param name="area"></param>
public void OnEnteredInteractable(Node area)
{
if (!_active || !InputService.Instance.InputEnabled)
return;
if (area is DetectableInteractionArea interactionArea2D)
{
EmitSignal(SignalName.InteractableEntered);
}
}
/// <summary>
/// Called whenever this node exits an Area2D.
/// </summary>
/// <param name="area"></param>
public void OnExitedInteractable(Node area)
{
if (!_active || !InputService.Instance.InputEnabled)
return;
if (area is DetectableInteractionArea interactionArea2D)
{
EmitSignal(SignalName.InteractableExited);
}
}
}
@@ -0,0 +1 @@
uid://c3pd60biootsx
@@ -92,7 +92,7 @@ public partial class InteractionArea2D : Node2D
private void TryInteract()
{
if (_area.HasOverlappingBodies())
if (_area.HasOverlappingAreas())
{
_label.Hide();