fix sun inside storage

This commit is contained in:
Ed
2025-03-08 14:55:37 +03:00
parent 978f9cf4b9
commit c06323374f
5 changed files with 10 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
using Content.Shared._CP14.DayCycle.Components;
using Content.Shared._CP14.DayCycle.Prototypes;
using Content.Shared.Maps;
using Content.Shared.Storage.Components;
using Content.Shared.Weather;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
@@ -30,14 +31,18 @@ public abstract class CP14SharedDayCycleSystem : EntitySystem
/// </summary>
/// <param name="target">An entity being tested to see if it is in daylight</param>
/// <param name="checkRoof">Checks if the tile covers the weather (the only "roof" factor at the moment)</param>
public bool TryDaylightThere(EntityUid target, bool checkRoof = true)
public bool UnderSunlight(EntityUid target)
{
if (HasComp<InsideEntityStorageComponent>(target))
return false;
var xform = Transform(target);
if (!TryComp<CP14DayCycleComponent>(xform.MapUid, out var dayCycle))
return false;
var day = dayCycle.CurrentPeriod == DayPeriod;
if (!checkRoof || !TryComp<MapGridComponent>(xform.GridUid, out var mapGrid))
if (!TryComp<MapGridComponent>(xform.GridUid, out var mapGrid))
return day;
var grid = xform.GridUid;