From 62c8e8e2928772a38ad154a772b29766594f2356 Mon Sep 17 00:00:00 2001 From: "adnan.mujkic" Date: Fri, 18 Sep 2026 21:27:30 +0200 Subject: [PATCH] Fix for watering every hour and seed bed texture fixes --- .../Seed/MI_SeedBedDecal_Inst.uasset | 4 +-- .../InventorySystem/Seed/MI_SeedBedMat.uasset | 4 +-- .../Seed/M_SeedBedDecal.uasset | 4 +-- .../0/61/A6L7ILYYQ9VI7SFIYFHFI5.uasset | 4 +-- .../ProjectEleri/Private/TimeOfDayManager.cpp | 36 ++++++++++++++----- Source/ProjectEleri/Public/TimeOfDayManager.h | 8 ++++- 6 files changed, 43 insertions(+), 17 deletions(-) diff --git a/Content/Scripts/InventorySystem/Seed/MI_SeedBedDecal_Inst.uasset b/Content/Scripts/InventorySystem/Seed/MI_SeedBedDecal_Inst.uasset index ed1ffcb1..1a7a7fd3 100644 --- a/Content/Scripts/InventorySystem/Seed/MI_SeedBedDecal_Inst.uasset +++ b/Content/Scripts/InventorySystem/Seed/MI_SeedBedDecal_Inst.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5e6b6ead6e22d05ab129f04617305ab4ee3ca4146568b4057fad5715e15de9b3 -size 10156 +oid sha256:1def7e34a13003e5b5ebdd5b6bc70617f8a1d007eb23b76faac50dbbb16b3541 +size 11531 diff --git a/Content/Scripts/InventorySystem/Seed/MI_SeedBedMat.uasset b/Content/Scripts/InventorySystem/Seed/MI_SeedBedMat.uasset index e91fae55..4cbd5272 100644 --- a/Content/Scripts/InventorySystem/Seed/MI_SeedBedMat.uasset +++ b/Content/Scripts/InventorySystem/Seed/MI_SeedBedMat.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fffb5b2271b8dce594b4b5b19e80733edf30054ae086ba2ce39a68037dc74f4a -size 8978 +oid sha256:6f6ed9682a91bbc0865eef6c677cf3e2011b48add0a1da286a4961c22cfdc1bd +size 10322 diff --git a/Content/Scripts/InventorySystem/Seed/M_SeedBedDecal.uasset b/Content/Scripts/InventorySystem/Seed/M_SeedBedDecal.uasset index bd7eacca..118edcd8 100644 --- a/Content/Scripts/InventorySystem/Seed/M_SeedBedDecal.uasset +++ b/Content/Scripts/InventorySystem/Seed/M_SeedBedDecal.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1869e3375e38d2e0ca7b8811ca2ce1ae3e05038cc077f4f7abea441196a1df21 -size 17811 +oid sha256:7bac5e35c0652f041937713c28102cdeeedf513758072d73f759721b636e8216 +size 19494 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/0/61/A6L7ILYYQ9VI7SFIYFHFI5.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/0/61/A6L7ILYYQ9VI7SFIYFHFI5.uasset index 7ad8f7b4..8afe7377 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/0/61/A6L7ILYYQ9VI7SFIYFHFI5.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/0/61/A6L7ILYYQ9VI7SFIYFHFI5.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a9da534e302f03004812cf727c01e84972f28ea1684808a73bcc948f21d1d6e -size 107177 +oid sha256:afa963394fe31f49b7d7f95a6af6cc00b25a2bb0cb044a5b070d5d359756ae27 +size 111923 diff --git a/Source/ProjectEleri/Private/TimeOfDayManager.cpp b/Source/ProjectEleri/Private/TimeOfDayManager.cpp index a95233e0..28e75cab 100644 --- a/Source/ProjectEleri/Private/TimeOfDayManager.cpp +++ b/Source/ProjectEleri/Private/TimeOfDayManager.cpp @@ -121,14 +121,7 @@ void ATimeOfDayManager::Tick(float DeltaTime) QueuedWeatherPreset = GetWeatherDistributionValue(); K2_WeatherFadeStart(QueuedWeatherPreset->bIsRain); - if (QueuedWeatherPreset->bIsRain) - { - // Rain refills the soil of every plant, the game state also reaches the beds that are streamed out - if (AEleriGameState* GameState = AEleriGameState::Get(this)) - { - GameState->WaterAllSeedBeds(); - } - } + WaterSeedBedsIfRaining(); } else { @@ -393,6 +386,28 @@ void ATimeOfDayManager::CheckLateHours() } } +bool ATimeOfDayManager::IsRaining() +{ + // While a weather change is blending, the queue is the weather the world is heading into, which is the same + // preset the rain toggle is already driven with, so rain reads as active from the first blended frame on + const UWeatherPresetDataAsset* ActivePreset = QueuedWeatherPreset ? QueuedWeatherPreset : CurrentWeatherPreset; + return IsValid(ActivePreset) && ActivePreset->bIsRain; +} + +void ATimeOfDayManager::WaterSeedBedsIfRaining() +{ + if (!IsRaining()) + { + return; + } + + // The game state owns the cache, so the beds that are streamed out are watered along with the loaded ones + if (AEleriGameState* GameState = AEleriGameState::Get(this)) + { + GameState->WaterAllSeedBeds(); + } +} + void ATimeOfDayManager::GoToSleep() { if (currentHours == 0 || currentHours == 1 || currentHours == 2) @@ -451,6 +466,11 @@ void ATimeOfDayManager::AddMinutes(float minutes) for (int32 HourIndex = AbsoluteHoursBefore; HourIndex < AbsoluteHoursAfter; ++HourIndex) { OnHourPassed.Broadcast(); + + // Sitting behind the broadcast makes the order deterministic: the beds have already drained a moisture + // hour and checked their plants for this hour, rain now refills the soil of every planted seed instead + // of only doing it once when the rain started + WaterSeedBedsIfRaining(); } NextWeatherChangeMinutes -= minutes; diff --git a/Source/ProjectEleri/Public/TimeOfDayManager.h b/Source/ProjectEleri/Public/TimeOfDayManager.h index 91eb2ccc..6e8ddac3 100644 --- a/Source/ProjectEleri/Public/TimeOfDayManager.h +++ b/Source/ProjectEleri/Public/TimeOfDayManager.h @@ -335,8 +335,11 @@ public: UFUNCTION(BlueprintCallable, Category = "Time of day") void GoToSleep(); + /** True while the weather the world is in, or is blending into, is a rain preset. + * The Raining property this used to read was never written anywhere, so the weather preset is the only + * live source of truth and it matches the bIsRain flag the rain toggle is driven with. */ UFUNCTION(BlueprintCallable, Category = "Time of day") - bool IsRaining() { return Raining; } + bool IsRaining(); UFUNCTION(BlueprintCallable, Category = "Time of day") void ToggleTimeActive(bool bNewActive); @@ -365,6 +368,9 @@ protected: void SetSkylightIntensity(const float &_rotator); void CheckLateHours(); + /** Refills the soil of every planted seed of every seed bed for the hour that just passed in the rain. */ + void WaterSeedBedsIfRaining(); + // Called every frame virtual void Tick(float DeltaTime) override;