Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DoutorWhite committed Dec 7, 2023
1 parent 3f23671 commit 0e9ae54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Content.Server/Light/EntitySystems/PoweredLightSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public sealed class PoweredLightSystem : EntitySystem
private TimeSystem _timeSystem = default!;
private List<EntityUid> _bulbList = new List<EntityUid>();
private List<PoweredLightComponent> _componentList = new List<PoweredLightComponent>();
private bool _isNightTime;
private bool _isStationDefined;
private bool _isTimeCycleEnabled;
private int _nightChangeTime;
Expand Down Expand Up @@ -118,8 +117,6 @@ private void OnInit(EntityUid uid, PoweredLightComponent light, ComponentInit ar
_lightBIncrease = _cfg.GetCVar(CCVars.BIncrease);
_lightBDecrease = _cfg.GetCVar(CCVars.BDecrease);
_lightIntensityFall = _cfg.GetCVar(CCVars.LightIntensityFall);
_isNightTime = false;
_isStationDefined = false;
}

private void OnMapInit(EntityUid uid, PoweredLightComponent light, MapInitEvent args)
Expand Down Expand Up @@ -334,8 +331,7 @@ private void UpdateLight(EntityUid uid,
var hours = _timeSystem.GetStationDate().Hour;
var energy = lightBulb.LightEnergy;
Color color = lightBulb.Color;
if ((hours < _dayChangeTime || hours >= _nightChangeTime) && _isTimeCycleEnabled && !_isNightTime &&
_entityManager.TryGetComponent(uid.ToCoordinates().GetGridUid(_entityManager), out StationMemberComponent? component))
if ((hours < _dayChangeTime || hours >= _nightChangeTime) && _isTimeCycleEnabled && _entityManager.TryGetComponent(uid.ToCoordinates().GetGridUid(_entityManager), out StationMemberComponent? component))
{
energy /= _lightIntensityFall;
int rbyte = LimitToByteMaxValue(_lightRIncrease * color.RByte / _lightRDecrease);
Expand Down Expand Up @@ -537,20 +533,20 @@ public override void Update(float frameTime)
var hours = _timeSystem.GetStationDate().Hour;
SoundSpecifier dayAlert = new SoundPathSpecifier("/Audio/Announcements/daytime.ogg");
SoundSpecifier nightAlert = new SoundPathSpecifier("/Audio/Announcements/nighttime.ogg");
if ((hours < _dayChangeTime || hours >= _nightChangeTime) && _isTimeCycleEnabled && !_isNightTime)
if ((hours < _dayChangeTime || hours >= _nightChangeTime) && _isTimeCycleEnabled && !_cfg.GetCVar(CCVars.NightTime))
{
ForceUpdate();
_isNightTime = true;
_cfg.SetCVar(CCVars.NightTime, true);
Console.WriteLine("Noite! Atualize as lampadas.");
if (_isStationDefined)
{
_chatSystem.DispatchStationAnnouncement(_originStation.GetValueOrDefault(), Loc.GetString("time-cycle-night"), "Central de Comando", true, nightAlert, colorOverride: Color.SkyBlue);
}
}
else if (hours >= _dayChangeTime && hours < _nightChangeTime && _isTimeCycleEnabled && _isNightTime)
else if (hours >= _dayChangeTime && hours < _nightChangeTime && _isTimeCycleEnabled && _cfg.GetCVar(CCVars.NightTime))
{
ForceUpdate();
_isNightTime = false;
_cfg.SetCVar(CCVars.NightTime, false);
if (_isStationDefined)
{
_chatSystem.DispatchStationAnnouncement(_originStation.GetValueOrDefault(), Loc.GetString("time-cycle-day"), "Central de Comando", true, dayAlert, colorOverride: Color.Orange);
Expand Down
2 changes: 2 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1826,6 +1826,8 @@ public static readonly CVarDef<float>
CVarDef.Create("time.initial", 28800, desc: "Tempo relativo inicial da rodada (segundos)", flag: CVar.REPLICATED);
public static readonly CVarDef<int> TimeAcceleration =
CVarDef.Create("time.acceleration", 24, desc: "Multiplicador do tempo relativo em relação ao tempo real (fator)", flag: CVar.REPLICATED);
public static readonly CVarDef<bool> NightTime =
CVarDef.Create("time.night_time", false, desc: "Não altere.", flag: CVar.SERVERONLY);
public static readonly CVarDef<bool> DayNightCycle =
CVarDef.Create("time.day_night_cycle", true, desc: "Define se o sistema de iluminação noturna estará ativado na estação. (true/false)", flag: CVar.SERVERONLY);
public static readonly CVarDef<float> LightIntensityFall =
Expand Down

0 comments on commit 0e9ae54

Please sign in to comment.