|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using System;
|
|
|
|
|
using Babushka.scripts.CSharp.Common.CharacterControls;
|
|
|
|
|
using Babushka.scripts.CSharp.Common.DayAndNight;
|
|
|
|
|
using Babushka.scripts.CSharp.Common.Inventory;
|
|
|
|
|
using Babushka.scripts.CSharp.Common.Savegame;
|
|
|
|
|
using Babushka.scripts.CSharp.Low_Code.Events;
|
|
|
|
|
@ -213,7 +214,8 @@ public partial class FieldBehaviour2D : Sprite2D, ISaveable
|
|
|
|
|
{
|
|
|
|
|
var payloadData = new Dictionary<string, Variant>
|
|
|
|
|
{
|
|
|
|
|
{ "field_state", (int)FieldState }
|
|
|
|
|
{ "field_state", (int)FieldState },
|
|
|
|
|
{ "day_count_on_last_exit", _currentDay}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (_currentPlant != null)
|
|
|
|
|
@ -265,35 +267,6 @@ public partial class FieldBehaviour2D : Sprite2D, ISaveable
|
|
|
|
|
{
|
|
|
|
|
_currentPlant.DaysWatered = plantDaysWatered.AsInt32();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get field state
|
|
|
|
|
if (save.TryGetValue("field_state", out Variant fieldStateVar))
|
|
|
|
|
{
|
|
|
|
|
int fieldStateInt = fieldStateVar.AsInt32();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if the field has been unlocked, make it visible.
|
|
|
|
|
if (fieldStateInt != 0)
|
|
|
|
|
{
|
|
|
|
|
Visible = true;
|
|
|
|
|
|
|
|
|
|
// if the field was watered the day before, set it to tilled or planted.
|
|
|
|
|
if (fieldStateInt == 3)
|
|
|
|
|
{
|
|
|
|
|
if (_currentPlant != null)
|
|
|
|
|
{
|
|
|
|
|
fieldStateInt = 2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fieldStateInt = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FieldState = (FieldState) fieldStateInt;
|
|
|
|
|
UpdateFieldState(FieldState, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get current day count: Load only. Saving the day count is handled on the day and night prefab.
|
|
|
|
|
@ -310,6 +283,43 @@ public partial class FieldBehaviour2D : Sprite2D, ISaveable
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get field state
|
|
|
|
|
if (save.TryGetValue("field_state", out Variant fieldStateVar))
|
|
|
|
|
{
|
|
|
|
|
int fieldStateInt = fieldStateVar.AsInt32();
|
|
|
|
|
|
|
|
|
|
// if the field has been unlocked, make it visible.
|
|
|
|
|
if (fieldStateInt != 0)
|
|
|
|
|
{
|
|
|
|
|
Visible = true;
|
|
|
|
|
|
|
|
|
|
if (save.TryGetValue("day_count_on_last_exit", out Variant lastDayCountVar))
|
|
|
|
|
{
|
|
|
|
|
int lastDayCount = lastDayCountVar.AsInt32();
|
|
|
|
|
|
|
|
|
|
// if day is today, then just use the provided field state as is.
|
|
|
|
|
if (CalendarController.Instance != null && _currentDay != lastDayCount)
|
|
|
|
|
{
|
|
|
|
|
// if the field was watered the day before, set it to tilled or planted.
|
|
|
|
|
if (fieldStateInt == 3)
|
|
|
|
|
{
|
|
|
|
|
if (_currentPlant != null)
|
|
|
|
|
{
|
|
|
|
|
fieldStateInt = 2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fieldStateInt = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FieldState = (FieldState) fieldStateInt;
|
|
|
|
|
UpdateFieldState(FieldState, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|