From 42afa7b754387ddfde1378bb16e542884bce2c42 Mon Sep 17 00:00:00 2001 From: Morb <14136326+Morb0@users.noreply.github.com> Date: Thu, 21 Aug 2025 15:28:10 -0700 Subject: [PATCH] Make IsDayNow method and return silva photosynthesis (#1648) * Make is day method and return silva photosynthesis * Disable CP14MagicEnergyDraw --- Content.Shared/_CP14/DayCycle/CP14DayCycleSystem.cs | 8 +++++++- Content.Shared/_CP14/Random/Rules/IsDaylight.cs | 4 ++-- .../Prototypes/_CP14/Entities/Mobs/Species/silva.yml | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Content.Shared/_CP14/DayCycle/CP14DayCycleSystem.cs b/Content.Shared/_CP14/DayCycle/CP14DayCycleSystem.cs index 16d99abc9b..8a6f3ac168 100644 --- a/Content.Shared/_CP14/DayCycle/CP14DayCycleSystem.cs +++ b/Content.Shared/_CP14/DayCycle/CP14DayCycleSystem.cs @@ -87,6 +87,12 @@ public sealed class CP14DayCycleSystem : EntitySystem return (float)lightLevel; } + public bool IsDayNow(Entity map) + { + var lightLevel = GetLightLevel(map); + return lightLevel >= 0.5; + } + /// /// Checks to see if the specified entity is on the map where it's daytime. /// @@ -101,7 +107,7 @@ public sealed class CP14DayCycleSystem : EntitySystem if (xform.MapUid is null || xform.GridUid is null) return false; - var day = GetLightLevel(xform.MapUid.Value) > 0.5f; + var day = IsDayNow(xform.MapUid.Value); var grid = xform.GridUid; if (grid is null) diff --git a/Content.Shared/_CP14/Random/Rules/IsDaylight.cs b/Content.Shared/_CP14/Random/Rules/IsDaylight.cs index 66bd8dbdda..3ad869d0f5 100644 --- a/Content.Shared/_CP14/Random/Rules/IsDaylight.cs +++ b/Content.Shared/_CP14/Random/Rules/IsDaylight.cs @@ -18,8 +18,8 @@ public sealed partial class CP14IsNight : RulesRule if (map is null) return false; - var lightLevel = dayCycle.GetLightLevel(map.Value); + var isDay = dayCycle.IsDayNow(map.Value); - return Inverted ? lightLevel < 0.5 : lightLevel >= 0.5; + return Inverted ? !isDay : isDay; } } diff --git a/Resources/Prototypes/_CP14/Entities/Mobs/Species/silva.yml b/Resources/Prototypes/_CP14/Entities/Mobs/Species/silva.yml index 061f07e864..addd487d43 100644 --- a/Resources/Prototypes/_CP14/Entities/Mobs/Species/silva.yml +++ b/Resources/Prototypes/_CP14/Entities/Mobs/Species/silva.yml @@ -67,7 +67,7 @@ - HealingT1 - HealingT2 - type: CP14MagicEnergyPhotosynthesis # Silva special feature #Disabled until sunlight fixed - - type: CP14MagicEnergyDraw #Enabled default mana regen until sunlight fixed + - type: CP14MagicEnergyDraw enable: false - type: Body prototype: CP14Silva