feature/bugfixes_And_Polish #39

Merged
Jonathan merged 6 commits from feature/bugfixes_And_Polish into develop 1 month ago

@ -3,19 +3,20 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://ccrnmx6bd842k" uid="uid://ccrnmx6bd842k"
path="res://.godot/imported/farm fäulnis blobs.png-afe542d3466e5ab2e79933f2f163e667.ctex" path.s3tc="res://.godot/imported/farm fäulnis blobs.png-afe542d3466e5ab2e79933f2f163e667.s3tc.ctex"
metadata={ metadata={
"vram_texture": false "imported_formats": ["s3tc_bptc"],
"vram_texture": true
} }
[deps] [deps]
source_file="res://art/characters/farm fäulnis blobs.png" source_file="res://art/characters/farm fäulnis blobs.png"
dest_files=["res://.godot/imported/farm fäulnis blobs.png-afe542d3466e5ab2e79933f2f163e667.ctex"] dest_files=["res://.godot/imported/farm fäulnis blobs.png-afe542d3466e5ab2e79933f2f163e667.s3tc.ctex"]
[params] [params]
compress/mode=0 compress/mode=2
compress/high_quality=false compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/uastc_level=0 compress/uastc_level=0
@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0
compress/hdr_compression=1 compress/hdr_compression=1
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=true
mipmaps/limit=-1 mipmaps/limit=-1
roughness/mode=0 roughness/mode=0
roughness/src_normal="" roughness/src_normal=""
@ -37,4 +38,4 @@ process/normal_map_invert_y=false
process/hdr_as_srgb=false process/hdr_as_srgb=false
process/hdr_clamp_exposure=false process/hdr_clamp_exposure=false
process/size_limit=0 process/size_limit=0
detect_3d/compress_to=1 detect_3d/compress_to=0

@ -12,3 +12,4 @@ ifquest res://resources/quests/demo/2_collect_ducks.tres, 1:
Yeli: Have you collected all the ducks yet? Yeli: Have you collected all the ducks yet?
[end_timeline] [end_timeline]
Yeli doesn't seem to have anything to say... Yeli doesn't seem to have anything to say...
[end_timeline]

@ -53,7 +53,7 @@
[sub_resource type="CircleShape2D" id="CircleShape2D_at1n1"] [sub_resource type="CircleShape2D" id="CircleShape2D_at1n1"]
resource_local_to_scene = true resource_local_to_scene = true
radius = 500.0 radius = 300.0
[sub_resource type="SpriteFrames" id="SpriteFrames_f6hss"] [sub_resource type="SpriteFrames" id="SpriteFrames_f6hss"]
animations = [{ animations = [{
@ -205,6 +205,7 @@ z_index = 1
y_sort_enabled = true y_sort_enabled = true
script = ExtResource("1_hn8at") script = ExtResource("1_hn8at")
_sprite = NodePath("TalkingControl/AnimatedSprite") _sprite = NodePath("TalkingControl/AnimatedSprite")
_retriggerSameTimeline = true
[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("42_ahrat")] [node name="InteractionArea" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("42_ahrat")]
position = Vector2(0, -450) position = Vector2(0, -450)
@ -244,9 +245,11 @@ stream = SubResource("AudioStreamRandomizer_ngji7")
bus = &"SFX" bus = &"SFX"
script = ExtResource("50_a7v1a") script = ExtResource("50_a7v1a")
[connection signal="FinishedTalking" from="." to="InteractionArea" method="SetActiveInverse"]
[connection signal="Talking" from="." to="Dialogic starter" method="open"] [connection signal="Talking" from="." to="Dialogic starter" method="open"]
[connection signal="Interacted" from="InteractionArea" to="." method="ToggleTalking"] [connection signal="Interacted" from="InteractionArea" to="." method="StartTalking"]
[connection signal="Interacted" from="InteractionArea" to="InteractionArea" method="ToggleActive"]
[connection signal="timelineEnded" from="Dialogic starter" to="." method="StopTalking"]
[connection signal="timelineEnded" from="Dialogic starter" to="InteractionArea" method="ToggleActive"]
[connection signal="timelineEnded" from="DialogicToggle" to="." method="ToggleTalking"] [connection signal="timelineEnded" from="DialogicToggle" to="." method="ToggleTalking"]
[connection signal="timelineStarted" from="DialogicToggle" to="SFX/AudioStreamPlayer" method="PlayOneShot"] [connection signal="timelineStarted" from="DialogicToggle" to="SFX/AudioStreamPlayer" method="PlayOneShot"]

@ -215,6 +215,7 @@ Payload = 3
[connection signal="Interacted" from="GrowingInteractionArea" to="." method="Grow"] [connection signal="Interacted" from="GrowingInteractionArea" to="." method="Grow"]
[connection signal="SuccessfulPickUp" from="ReadyPlantInventoryItem" to="." method="queue_free"] [connection signal="SuccessfulPickUp" from="ReadyPlantInventoryItem" to="." method="queue_free"]
[connection signal="Interacted" from="ReadyPlantInventoryItem/PickupInteractionArea" to="." method="Harvest"]
[editable path="GrowingInteractionArea"] [editable path="GrowingInteractionArea"]
[editable path="ReadyPlantInventoryItem"] [editable path="ReadyPlantInventoryItem"]

@ -48,9 +48,6 @@ shape = SubResource("CircleShape2D_hiixr")
[node name="SpawnWithItem" parent="ReadyPlantInventoryItem" index="0"] [node name="SpawnWithItem" parent="ReadyPlantInventoryItem" index="0"]
_blueprint = ExtResource("3_agmuy") _blueprint = ExtResource("3_agmuy")
[node name="PickupInteractionArea" parent="ReadyPlantInventoryItem" index="3"]
_active = false
[node name="CollisionShape3D" parent="ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"] [node name="CollisionShape3D" parent="ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_ae08q") shape = SubResource("CircleShape2D_ae08q")

@ -1030,7 +1030,6 @@ y_sort_enabled = true
[node name="Yeli" parent="YSorted" instance=ExtResource("24_wtdui")] [node name="Yeli" parent="YSorted" instance=ExtResource("24_wtdui")]
position = Vector2(6403, 3362) position = Vector2(6403, 3362)
_timelinesToPlay = PackedStringArray("yeli_quest_select") _timelinesToPlay = PackedStringArray("yeli_quest_select")
_retriggerSameTimeline = true
[node name="Vesna" parent="YSorted" instance=ExtResource("1_7wfwe")] [node name="Vesna" parent="YSorted" instance=ExtResource("1_7wfwe")]
z_index = 1 z_index = 1
@ -2375,6 +2374,7 @@ position = Vector2(-5016, 3361)
visible = false visible = false
z_index = 1 z_index = 1
y_sort_enabled = true y_sort_enabled = true
position = Vector2(-204, -5186)
[node name="trashObject" parent="YSorted/trash" instance=ExtResource("53_ycj14")] [node name="trashObject" parent="YSorted/trash" instance=ExtResource("53_ycj14")]
z_index = 0 z_index = 0

File diff suppressed because it is too large Load Diff

@ -223,6 +223,7 @@ _sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_indoor_vesnas
[node name="Foreground" type="Node" parent="."] [node name="Foreground" type="Node" parent="."]
[node name="Table" type="Sprite2D" parent="Foreground"] [node name="Table" type="Sprite2D" parent="Foreground"]
z_index = 2
y_sort_enabled = true y_sort_enabled = true
position = Vector2(-1888, 1112) position = Vector2(-1888, 1112)
texture = ExtResource("2_ubg3a") texture = ExtResource("2_ubg3a")
@ -231,6 +232,7 @@ region_enabled = true
region_rect = Rect2(1012, 1743, 1470, 417) region_rect = Rect2(1012, 1743, 1470, 417)
[node name="Chair" type="Sprite2D" parent="Foreground"] [node name="Chair" type="Sprite2D" parent="Foreground"]
z_index = 3
y_sort_enabled = true y_sort_enabled = true
position = Vector2(-3032, 2096) position = Vector2(-3032, 2096)
texture = ExtResource("3_gpagp") texture = ExtResource("3_gpagp")

@ -1760,6 +1760,7 @@ metadata/SaveID = "7a8210bf-479d-4b4c-9758-98d23e59d5d7"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2 _state = 2
_field = NodePath("../..") _field = NodePath("../..")
_daysWatered = 6
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField" index="7"] [node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField" index="7"]
visible = false visible = false
@ -1780,6 +1781,7 @@ metadata/SaveID = "a1d8a0a2-c51c-4410-83c3-0edb31cbf2de"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField2/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField2/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2 _state = 2
_field = NodePath("../..") _field = NodePath("../..")
_daysWatered = 6
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField2" index="7"] [node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField2" index="7"]
visible = false visible = false
@ -1800,6 +1802,7 @@ metadata/SaveID = "79a65532-cb2b-4268-8eb0-8c41a3935cbb"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField3/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField3/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2 _state = 2
_field = NodePath("../..") _field = NodePath("../..")
_daysWatered = 5
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField3" index="7"] [node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField3" index="7"]
visible = false visible = false
@ -1821,6 +1824,7 @@ metadata/SaveID = "13fa64a3-01dc-4fd8-822e-0839c0da3163"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField4/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField4/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2 _state = 2
_field = NodePath("../..") _field = NodePath("../..")
_daysWatered = 7
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField4" index="7"] [node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField4" index="7"]
visible = false visible = false
@ -1842,6 +1846,7 @@ metadata/SaveID = "414ecdb9-f3c4-4fb9-81bd-6ca575784f78"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField5/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField5/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2 _state = 2
_field = NodePath("../..") _field = NodePath("../..")
_daysWatered = 6
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField5" index="7"] [node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField5" index="7"]
visible = false visible = false
@ -1863,6 +1868,7 @@ metadata/SaveID = "b235febb-b231-4f8c-94e9-1f9d9f115b08"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField6/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField6/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 1 _state = 1
_field = NodePath("../..") _field = NodePath("../..")
_daysWatered = 5
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField6" index="7"] [node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField6" index="7"]
visible = false visible = false
@ -1884,6 +1890,7 @@ metadata/SaveID = "9ccdba91-812a-4c13-9ee0-12472e174fc9"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField7/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField7/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2 _state = 2
_field = NodePath("../..") _field = NodePath("../..")
_daysWatered = 6
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField7" index="7"] [node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField7" index="7"]
visible = false visible = false
@ -1905,6 +1912,7 @@ metadata/SaveID = "da44e54a-0b76-4888-ad8b-782a9d146fa3"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField8/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")] [node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField8/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2 _state = 2
_field = NodePath("../..") _field = NodePath("../..")
_daysWatered = 6
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField8" index="7"] [node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField8" index="7"]
visible = false visible = false

@ -205,6 +205,12 @@ public partial class FieldBehaviour2D : Sprite2D, ISaveable
} }
} }
public void HarvestPlant()
{
_currentPlant = null;
UpdateFieldState(FieldState.Empty, true);
}
#region SAVE AND LOAD #region SAVE AND LOAD
/// <summary> /// <summary>
@ -244,6 +250,9 @@ public partial class FieldBehaviour2D : Sprite2D, ISaveable
Dictionary<string, Variant> save = SavegameService.GetSaveData(id); Dictionary<string, Variant> save = SavegameService.GetSaveData(id);
// if we already have a plant, don't instantiate another one
int plantCount = PlantingPlaceholder.GetChildCount();
if (save.Count > 0) if (save.Count > 0)
{ {
// get plant first because it's also relevant for the field state // get plant first because it's also relevant for the field state
@ -253,12 +262,16 @@ public partial class FieldBehaviour2D : Sprite2D, ISaveable
if (plantDataDict.TryGetValue("prefab_path", out Variant prefabPathVar)) if (plantDataDict.TryGetValue("prefab_path", out Variant prefabPathVar))
{ {
InstantiatePlant(prefabPathVar.AsString()); if(plantCount == 0)
InstantiatePlant(prefabPathVar.AsString());
else
_currentPlant = PlantingPlaceholder.GetChild(0) as PlantBehaviour2D;
} }
else else
{ {
return; return;
} }
if (plantDataDict.TryGetValue("plant_start_day", out Variant plantStartDay) && _currentPlant != null) if (plantDataDict.TryGetValue("plant_start_day", out Variant plantStartDay) && _currentPlant != null)
{ {
_currentPlant.DayPlanted = plantStartDay.AsInt32(); _currentPlant.DayPlanted = plantStartDay.AsInt32();

@ -27,6 +27,7 @@ public partial class PlantBehaviour2D : Node2D
[ExportGroup("PlantConfig")] [ExportGroup("PlantConfig")]
[Export] private string _prefabPath; [Export] private string _prefabPath;
[Export] private VariableNode _lifecycle; [Export] private VariableNode _lifecycle;
[Export] private int _daysWatered;
private string _magicWordDialogicEventName = "MagicWord"; private string _magicWordDialogicEventName = "MagicWord";
private Sprite2D? _currentPlantSprite = null; private Sprite2D? _currentPlantSprite = null;
@ -34,7 +35,6 @@ public partial class PlantBehaviour2D : Node2D
private bool _calledOnReady = false; private bool _calledOnReady = false;
private int _dayPlanted; private int _dayPlanted;
private int _currentDay; private int _currentDay;
private int _daysWatered;
public PlantState State public PlantState State
{ {
@ -160,14 +160,14 @@ public partial class PlantBehaviour2D : Node2D
_currentPlantSprite.Visible = false; _currentPlantSprite.Visible = false;
_currentPlantSprite = GetRandomSprite(_readyPlants); _currentPlantSprite = GetRandomSprite(_readyPlants);
_currentPlantSprite.Visible = true; _currentPlantSprite.Visible = true;
ActivatePickupAfterDelay(true); SetActiveHarvestablePlant(true);
break; break;
case PlantState.Ready: case PlantState.Ready:
_state = PlantState.None; _state = PlantState.None;
if(_currentPlantSprite != null) if(_currentPlantSprite != null)
_currentPlantSprite.Visible = false; _currentPlantSprite.Visible = false;
_currentPlantSprite = null; _currentPlantSprite = null;
ActivatePickupAfterDelay(false); SetActiveHarvestablePlant(false);
break; break;
default: default:
break; break;
@ -184,12 +184,6 @@ public partial class PlantBehaviour2D : Node2D
return sprites[rand.Next(sprites.Length)]; 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) private void SetActiveHarvestablePlant(bool active)
{ {
_harvestablePlant.IsActive = active; _harvestablePlant.IsActive = active;
@ -206,4 +200,9 @@ public partial class PlantBehaviour2D : Node2D
_magicWordSaid = true; _magicWordSaid = true;
Grow(); Grow();
} }
public void Harvest()
{
Field.HarvestPlant();
}
} }

@ -1,3 +1,4 @@
using Babushka.scripts.CSharp.Common.Services;
using Godot; using Godot;
namespace Babushka.scripts.CSharp.Common.NPC; namespace Babushka.scripts.CSharp.Common.NPC;
@ -8,37 +9,28 @@ public partial class TalkingCharacter : Node2D
[Export] private string[] _timelinesToPlay; [Export] private string[] _timelinesToPlay;
[Export] private bool _retriggerSameTimeline = false; [Export] private bool _retriggerSameTimeline = false;
private bool _isTalking = true;
private int _timelineIndex = 0; private int _timelineIndex = 0;
[Signal] public delegate void TalkingEventHandler(string timelineName); [Signal] public delegate void TalkingEventHandler(string timelineName);
[Signal] public delegate void FinishedTalkingEventHandler(bool hasTimeLinesToPlay);
public override void _Ready() public void StartTalking()
{ {
ToggleTalking(); if (_sprite != null)
_sprite.Animation = "talk";
EmitSignal(SignalName.Talking, _timelinesToPlay[_timelineIndex]);
if (!_retriggerSameTimeline)
_timelineIndex++;
InputService.Instance.InputEnabled = false;
if (_sprite != null)
_sprite.Play();
} }
public void ToggleTalking() public void StopTalking()
{ {
if (_isTalking || _timelineIndex >= _timelinesToPlay.Length) if (_sprite != null)
{ _sprite.Animation = "idle";
if (_sprite != null) InputService.Instance.InputEnabled = true;
_sprite.Animation = "idle";
_isTalking = false;
}
else
{
if (_sprite != null)
_sprite.Animation = "talk";
_isTalking = true;
EmitSignal(SignalName.Talking, _timelinesToPlay[_timelineIndex]);
if (!_retriggerSameTimeline)
_timelineIndex++;
}
if (_sprite != null) if (_sprite != null)
_sprite.Play(); _sprite.Play();
EmitSignal(SignalName.FinishedTalking, _timelineIndex >= _timelinesToPlay.Length);
} }
} }

@ -1,5 +1,18 @@
extends Node extends Node
class_name DialogicStarter class_name DialogicStarter
signal timelineStarted
signal timelineEnded
func _ready() -> void:
Dialogic.timeline_ended.connect(_on_timeline_ended)
Dialogic.timeline_started.connect(_start_dialog)
func open(timeline: String): func open(timeline: String):
Dialogic.start(timeline) Dialogic.start(timeline)
func _start_dialog() -> void:
timelineStarted.emit()
func _on_timeline_ended() -> void:
timelineEnded.emit()

Loading…
Cancel
Save