fix sun inside storage
This commit is contained in:
@@ -28,7 +28,7 @@ public sealed partial class CP14FarmingSystem
|
||||
private void OnTakeEnergyFromLight(Entity<CP14PlantEnergyFromLightComponent> regeneration, ref CP14PlantUpdateEvent args)
|
||||
{
|
||||
var gainEnergy = false;
|
||||
var daylight = _dayCycle.TryDaylightThere(regeneration, true);
|
||||
var daylight = _dayCycle.UnderSunlight(regeneration);
|
||||
|
||||
if (regeneration.Comp.Daytime && daylight)
|
||||
gainEnergy = true;
|
||||
|
||||
@@ -68,7 +68,7 @@ public sealed class CP14VampireRuleSystem : GameRuleSystem<CP14VampireRuleCompon
|
||||
|
||||
vampire.NextHeatTime = _timing.CurTime + vampire.HeatFrequency;
|
||||
|
||||
if (!_dayCycle.TryDaylightThere(uid))
|
||||
if (!_dayCycle.UnderSunlight(uid))
|
||||
continue;
|
||||
|
||||
_temperature.ChangeHeat(uid, vampire.HeatUnderSunTemperature);
|
||||
|
||||
@@ -67,7 +67,7 @@ public partial class CP14MagicEnergySystem
|
||||
|
||||
draw.NextUpdateTime = _gameTiming.CurTime + TimeSpan.FromSeconds(draw.Delay);
|
||||
|
||||
ChangeEnergy(uid, _dayCycle.TryDaylightThere(uid) ? draw.DaylightEnergy : draw.DarknessEnergy, out _, out _, magicContainer, true);
|
||||
ChangeEnergy(uid, _dayCycle.UnderSunlight(uid) ? draw.DaylightEnergy : draw.DarknessEnergy, out _, out _, magicContainer, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared._CP14.MagicSpell.Spells;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user