using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
+using Robust.Shared.Graphics;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
/// </summary>
public sealed class FireVisualizerSystem : VisualizerSystem<FireVisualsComponent>
{
+ [Dependency] private readonly PointLightSystem _lights = default!;
+
public override void Initialize()
{
base.Initialize();
component.LightEntity ??= Spawn(null, new EntityCoordinates(uid, default));
var light = EnsureComp<PointLightComponent>(component.LightEntity.Value);
- light.Color = component.LightColor;
+ _lights.SetColor(component.LightEntity.Value, component.LightColor, light);
// light needs a minimum radius to be visible at all, hence the + 1.5f
- light.Radius = Math.Clamp(1.5f + component.LightRadiusPerStack * fireStacks, 0f, component.MaxLightRadius);
- light.Energy = Math.Clamp(1 + component.LightEnergyPerStack * fireStacks, 0f, component.MaxLightEnergy);
+ _lights.SetRadius(component.LightEntity.Value, Math.Clamp(1.5f + component.LightRadiusPerStack * fireStacks, 0f, component.MaxLightRadius), light);
+ _lights.SetEnergy(component.LightEntity.Value, Math.Clamp(1 + component.LightEnergyPerStack * fireStacks, 0f, component.MaxLightEnergy), light);
// TODO flickering animation? Or just add a noise mask to the light? But that requires an engine PR.
}
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
+using Robust.Shared.Graphics.RSI;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Prototypes;
if (!rsi.TryGetState(stateId, out var state)) continue;
- _frames[i] = state.GetFrames(RSI.State.Direction.South);
+ _frames[i] = state.GetFrames(RsiDirection.South);
_frameDelays[i] = state.GetDelays();
_frameCounter[i] = 0;
break;
if (!fire.TryGetState((i + 1).ToString(), out var state))
throw new ArgumentOutOfRangeException($"Fire RSI doesn't have state \"{i}\"!");
- _fireFrames[i] = state.GetFrames(RSI.State.Direction.South);
+ _fireFrames[i] = state.GetFrames(RsiDirection.South);
_fireFrameDelays[i] = state.GetDelays();
_fireFrameCounter[i] = 0;
}
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.XAML;
using static Content.Shared.Atmos.Components.GasAnalyzerComponent;
+using Direction = Robust.Shared.Maths.Direction;
namespace Content.Client.Atmos.UI
{
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Client.Utility;
+using Robust.Shared.Graphics;
+using Robust.Shared.Graphics.RSI;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
return SampleClickMap(clickMap, pos, clickMap.Size, Vector2i.Zero);
}
- public bool IsOccluding(RSI rsi, RSI.StateId state, RSI.State.Direction dir, int frame, Vector2i pos)
+ public bool IsOccluding(RSI rsi, RSI.StateId state, RsiDirection dir, int frame, Vector2i pos)
{
if (!_rsiMaps.TryGetValue(rsi, out var rsiData))
{
{
public bool IsOccluding(Texture texture, Vector2i pos);
- public bool IsOccluding(RSI rsi, RSI.StateId state, RSI.State.Direction dir, int frame, Vector2i pos);
+ public bool IsOccluding(RSI rsi, RSI.StateId state, RsiDirection dir, int frame, Vector2i pos);
}
}
using Robust.Client.Utility;
using Robust.Shared.Graphics;
using static Robust.Client.GameObjects.SpriteComponent;
+using Direction = Robust.Shared.Maths.Direction;
namespace Content.Client.Clickable
{
if (layer.ActualRsi is not { } rsi || !rsi.TryGetState(layer.State, out var rsiState))
continue;
- var dir = Layer.GetDirection(rsiState.Directions, relativeRotation);
+ var dir = Layer.GetDirection(rsiState.RsiDirections, relativeRotation);
// convert to layer-local coordinates
layer.GetLayerDrawMatrix(dir, out var matrix);
// Next, to get the right click map we need the "direction" of this layer that is actually being used to draw the sprite on the screen.
// This **can** differ from the dir defined before, but can also just be the same.
if (sprite.EnableDirectionOverride)
- dir = sprite.DirectionOverride.Convert(rsiState.Directions);
+ dir = sprite.DirectionOverride.Convert(rsiState.RsiDirections);
dir = dir.OffsetRsiDir(layer.DirOffset);
if (_clickMapManager.IsOccluding(layer.ActualRsi!, layer.State, dir, layer.AnimationFrame, layerImagePos))
using Robust.Client.Input;
using Robust.Client.UserInterface;
using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
using Robust.Shared.Utility;
namespace Content.Client.CombatMode;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Graphics;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Client.UserInterface.Controls;
using Robust.Client.Utility;
using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
using Robust.Shared.Prototypes;
using static Robust.Client.UserInterface.Controls.BaseButton;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Client.Utility;
+using Robust.Shared.Graphics;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BaseButton;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Client.Utility;
+using Robust.Shared.Graphics;
using static Robust.Client.UserInterface.Controls.BaseButton;
namespace Content.Client.Decals.UI;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
public sealed class DragonSystem : EntitySystem
{
+ [Dependency] private readonly SharedPointLightSystem _lights = default!;
+
public override void Initialize()
{
base.Initialize();
sprite?.LayerSetColor(0, Color.FromHex("#569fff"));
if (light != null)
- light.Color = Color.FromHex("#366db5");
+ {
+ _lights.SetColor(uid, Color.FromHex("#366db5"), light);
+ }
break;
case DragonRiftState.AlmostFinished:
sprite?.LayerSetColor(0, Color.FromHex("#cf4cff"));
if (light != null)
- light.Color = Color.FromHex("#9e2fc1");
+ {
+ _lights.SetColor(uid, Color.FromHex("#9e2fc1"), light);
+ }
break;
case DragonRiftState.Finished:
sprite?.LayerSetColor(0, Color.FromHex("#edbc36"));
if (light != null)
- light.Color = Color.FromHex("#cbaf20");
+ {
+ _lights.SetColor(uid, Color.FromHex("#cbaf20"), light);
+ }
break;
}
}
using static Robust.Client.UserInterface.Controls.BoxContainer;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
+using Direction = Robust.Shared.Maths.Direction;
namespace Content.Client.Examine
{
using Content.Shared.Explosion;
-using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.GameStates;
+using Robust.Shared.Graphics.RSI;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
[Dependency] private readonly IPrototypeManager _protoMan = default!;
[Dependency] private readonly IResourceCache _resCache = default!;
[Dependency] private readonly IOverlayManager _overlayMan = default!;
+ [Dependency] private readonly SharedPointLightSystem _lights = default!;
/// <summary>
/// For how many seconds should an explosion stay on-screen once it has finished expanding?
// spawn in a client-side light source at the epicenter
var lightEntity = Spawn("ExplosionLight", component.Epicenter);
- var light = EnsureComp<PointLightComponent>(lightEntity);
- light.Energy = light.Radius = component.Intensity.Count;
- light.Color = type.LightColor;
+ var light = _lights.EnsureLight(lightEntity);
+
+ _lights.SetRadius(lightEntity, component.Intensity.Count, light);
+ _lights.SetEnergy(lightEntity, component.Intensity.Count, light);
+ _lights.SetColor(lightEntity, type.LightColor, light);
textures.LightEntity = lightEntity;
textures.FireColor = type.FireColor;
var fireRsi = _resCache.GetResource<RSIResource>(type.TexturePath).RSI;
foreach (var state in fireRsi)
{
- textures.FireFrames.Add(state.GetFrames(RSI.State.Direction.South));
+ textures.FireFrames.Add(state.GetFrames(RsiDirection.South));
if (textures.FireFrames.Count == type.FireStates)
break;
}
using Robust.Client.Graphics;
+using Robust.Shared.Graphics;
namespace Content.Client.Explosion;
using Robust.Client.State;
using Robust.Client.Player;
using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Client.UserInterface;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
using Robust.Shared.Map;
+using Direction = Robust.Shared.Maths.Direction;
namespace Content.Client.Hands
{
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
+using Robust.Shared.Graphics;
namespace Content.Client.Kitchen.UI
{
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Graphics;
namespace Content.Client.Lathe.UI;
if (Enabled && _entMan.TryGetComponent(_parent, out PointLightComponent? light))
{
- light.Enabled = true;
+ _entMan.System<PointLightSystem>().SetEnabled(_parent, true, light);
}
OnInitialize();
{
if (_entMan.TryGetComponent(_parent, out PointLightComponent? light))
{
- light.Enabled = true;
+ _entMan.System<PointLightSystem>().SetEnabled(_parent, true, light);
}
if (MinDuration > 0)
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly ItemSystem _itemSystem = default!;
+ [Dependency] private readonly SharedPointLightSystem _lights = default!;
public override void Initialize()
{
if (!Resolve(uid, ref rgb, ref sprite, ref light, false))
return;
- light.Color = rgb.OriginalLightColor;
+ _lights.SetColor(uid, rgb.OriginalLightColor, light);
if (rgb.Layers == null || rgb.OriginalLayerColors == null)
return;
{
var color = GetCurrentRgbColor(_gameTiming.RealTime, rgb.CreationTick.Value * _gameTiming.TickPeriod, rgb);
- light.Color = color;
+ _lights.SetColor(light.Owner, color, light);
if (rgb.Layers != null)
{
using Robust.Shared.Utility;
using Robust.Shared.Configuration;
using Robust.Shared.ContentPack;
+using Robust.Shared.Graphics;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using System.Threading;
using System.Threading.Tasks;
using Robust.Client.Graphics;
+using Robust.Shared.Graphics;
namespace Content.Client.Parallax.Data
{
using Content.Client.Resources;
using Content.Client.IoC;
using Robust.Client.Graphics;
+using Robust.Shared.Graphics;
using Robust.Shared.Utility;
namespace Content.Client.Parallax.Data;
using System;
using Robust.Client.Graphics;
using Content.Client.Parallax.Data;
+using Robust.Shared.Graphics;
namespace Content.Client.Parallax;
public sealed class ApcVisualizerSystem : VisualizerSystem<ApcVisualsComponent>
{
+ [Dependency] private readonly SharedPointLightSystem _lights = default!;
+
protected override void OnAppearanceChange(EntityUid uid, ApcVisualsComponent comp, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
}
}
- if (TryComp<SharedPointLightComponent>(uid, out var light))
- light.Color = comp.ScreenColors[(sbyte)chargeState];
+ if (TryComp<PointLightComponent>(uid, out var light))
+ {
+ _lights.SetColor(uid, comp.ScreenColors[(sbyte)chargeState], light);
+ }
}
else
{
args.Sprite.LayerSetVisible(layer, false);
}
- if (TryComp<SharedPointLightComponent>(uid, out var light))
- light.Color = comp.EmaggedScreenColor;
+ if (TryComp<PointLightComponent>(uid, out var light))
+ {
+ _lights.SetColor(uid, comp.EmaggedScreenColor, light);
+ }
}
}
}
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Graphics;
+using Robust.Shared.Graphics.RSI;
using Robust.Shared.Prototypes;
namespace Content.Client.Power;
IRsiStateLike? iconState = null;
if (entityPrototype != null)
iconState = _spriteSystem.GetPrototypeIcon(entityPrototype);
- var icon = iconState?.GetFrame(RSI.State.Direction.South, 0);
+ var icon = iconState?.GetFrame(RsiDirection.South, 0);
var item = list[i];
item.Text = $"{ent.NameLocalized} {Loc.GetString("power-monitoring-window-value", ("value", ent.Size))}";
item.Icon = icon;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using static Robust.Client.UserInterface.Controls.BoxContainer;
+using Direction = Robust.Shared.Maths.Direction;
namespace Content.Client.Preferences.UI
{
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BoxContainer;
+using Direction = Robust.Shared.Maths.Direction;
namespace Content.Client.Preferences.UI
{
using JetBrains.Annotations;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
+using Robust.Shared.Graphics;
using Robust.Shared.Utility;
namespace Content.Client.Resources
public sealed class RevenantOverloadedLightsSystem : SharedRevenantOverloadedLightsSystem
{
+ [Dependency] private readonly SharedPointLightSystem _lights = default!;
+
public override void Initialize()
{
base.Initialize();
var enumerator = EntityQueryEnumerator<RevenantOverloadedLightsComponent, PointLightComponent>();
- while (enumerator.MoveNext(out var comp, out var light))
+ while (enumerator.MoveNext(out var uid, out var comp, out var light))
{
//this looks cool :HECK:
- light.Energy = 2f * Math.Abs((float) Math.Sin(0.25 * Math.PI * comp.Accumulator));
+ _lights.SetEnergy(uid, 2f * Math.Abs((float) Math.Sin(0.25 * Math.PI * comp.Accumulator)), light);
}
}
private void OnStartup(EntityUid uid, RevenantOverloadedLightsComponent component, ComponentStartup args)
{
- var light = EnsureComp<PointLightComponent>(uid);
+ var light = _lights.EnsureLight(uid);
component.OriginalEnergy = light.Energy;
component.OriginalEnabled = light.Enabled;
- light.Enabled = component.OriginalEnabled;
- Dirty(light);
+ _lights.SetEnabled(uid, component.OriginalEnabled, light);
+ Dirty(uid, light);
}
private void OnShutdown(EntityUid uid, RevenantOverloadedLightsComponent component, ComponentShutdown args)
{
- if (!TryComp<PointLightComponent>(component.Owner, out var light))
+ if (!_lights.TryGetLight(uid, out var light))
return;
if (component.OriginalEnergy == null)
{
- RemComp<PointLightComponent>(component.Owner);
+ RemComp(uid, light);
return;
}
- light.Energy = component.OriginalEnergy.Value;
- light.Enabled = component.OriginalEnabled;
- Dirty(light);
+ _lights.SetEnergy(uid, component.OriginalEnergy.Value, light);
+ _lights.SetEnabled(uid, component.OriginalEnabled, light);
+ Dirty(uid, light);
}
protected override void OnZap(RevenantOverloadedLightsComponent component)
using Robust.Shared.Serialization.TypeSerializers.Implementations;
using Robust.Shared.Utility;
using System.Linq;
+using Robust.Shared.Graphics;
namespace Content.Client.SprayPainter;
using Robust.Client.UserInterface;
using static Robust.Client.UserInterface.Controls.BoxContainer;
using static Content.Shared.Storage.SharedStorageComponent;
+using Direction = Robust.Shared.Maths.Direction;
namespace Content.Client.Storage.UI
{
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Graphics;
namespace Content.Client.Store.Ui;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
+using Robust.Shared.Graphics;
using static Robust.Client.UserInterface.StylesheetHelpers;
namespace Content.Client.Stylesheets
public sealed class ToggleableLightVisualsSystem : VisualizerSystem<ToggleableLightVisualsComponent>
{
[Dependency] private readonly SharedItemSystem _itemSys = default!;
+ [Dependency] private readonly SharedPointLightSystem _lights = default!;
public override void Initialize()
{
if (TryComp(uid, out PointLightComponent? light))
{
DebugTools.Assert(!light.NetSyncEnabled, "light visualizers require point lights without net-sync");
- light.Enabled = enabled;
+ _lights.SetEnabled(uid, enabled, light);
if (enabled && modulate)
- light.Color = color;
+ {
+ _lights.SetColor(uid, color, light);
+ }
}
// update clothing & in-hand visuals.
using System.Numerics;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
+using Direction = Robust.Shared.Maths.Direction;
namespace Content.Client.UserInterface.Controls;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Graphics;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.UserInterface.Controls;
+using Robust.Shared.Graphics;
using Robust.Shared.Input;
using Robust.Shared.Utility;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers;
using Robust.Client.UserInterface.Controls;
+using Robust.Shared.Graphics.RSI;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Timing;
if (entIcon != null)
{
_dragShadow.Texture = EntityManager.GetComponent<SpriteComponent>(entIcon.Value).Icon?
- .GetFrame(RSI.State.Direction.South, 0);
+ .GetFrame(RsiDirection.South, 0);
}
else if (action.Icon != null)
{
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.Utility;
+using Robust.Shared.Graphics;
using Robust.Shared.Input;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BoxContainer;
using static Robust.Client.UserInterface.Controls.TextureRect;
+using Direction = Robust.Shared.Maths.Direction;
namespace Content.Client.UserInterface.Systems.Actions.Controls;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Graphics;
using Robust.Shared.Prototypes;
namespace Content.Client.VendingMachines.UI
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
+using Robust.Shared.Graphics;
namespace Content.Client.Weapons.Ranged.Systems;
light.NetSyncEnabled = false;
Lights.SetEnabled(uid, true, light);
Lights.SetRadius(uid, 2f, light);
- light.Color = Color.FromHex("#cc8e2b");
- light.Energy = 5f;
+ Lights.SetColor(uid, Color.FromHex("#cc8e2b"), light);
+ Lights.SetEnergy(uid, 5f, light);
var animTwo = new Animation()
{
using Robust.Client.ResourceManagement;
using Robust.Client.Utility;
using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
+using Robust.Shared.Graphics.RSI;
using Robust.Shared.Map;
using Robust.Shared.Physics.Components;
using Robust.Shared.Prototypes;
case SpriteSpecifier.Rsi rsi:
var rsiActual = _cache.GetResource<RSIResource>(rsi.RsiPath).RSI;
rsiActual.TryGetState(rsi.RsiState, out var state);
- var frames = state!.GetFrames(RSI.State.Direction.South);
+ var frames = state!.GetFrames(RsiDirection.South);
var delays = state.GetDelays();
var totalDelay = delays.Sum();
var time = curTime.TotalSeconds % totalDelay;
return;
Appearance.SetData(uid, AnomalyVesselVisuals.HasAnomaly, on, appearanceComponent);
- if (TryComp<SharedPointLightComponent>(uid, out var pointLightComponent))
+ if (_pointLight.TryGetLight(uid, out var pointLightComponent))
_pointLight.SetEnabled(uid, on, pointLightComponent);
// arbitrary value for the generic visualizer to use.
public sealed partial class BotanySystem : EntitySystem
{
- [Dependency] private readonly AppearanceSystem _appearance = default!;
- [Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
- [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
+ [Dependency] private readonly AppearanceSystem _appearance = default!;
+ [Dependency] private readonly PopupSystem _popupSystem = default!;
+ [Dependency] private readonly SharedHandsSystem _hands = default!;
+ [Dependency] private readonly SharedPointLightSystem _light = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly FixtureSystem _fixtureSystem = default!;
if (proto.Bioluminescent)
{
- var light = EnsureComp<PointLightComponent>(entity);
- light.Radius = proto.BioluminescentRadius;
- light.Color = proto.BioluminescentColor;
- light.CastShadows = false; // this is expensive, and botanists make lots of plants
- Dirty(light);
+ var light = _light.EnsureLight(entity);
+ _light.SetRadius(entity, proto.BioluminescentRadius, light);
+ _light.SetColor(entity, proto.BioluminescentColor, light);
+ // TODO: Ayo why you copy-pasting code between here and plantholder?
+ _light.SetCastShadows(entity, false, light); // this is expensive, and botanists make lots of plants
}
if (proto.Slip)
{
var slippery = EnsureComp<SlipperyComponent>(entity);
- EntityManager.Dirty(slippery);
+ Dirty(entity, slippery);
EnsureComp<StepTriggerComponent>(entity);
// Need a fixture with a slip layer in order to actually do the slipping
var fixtures = EnsureComp<FixturesComponent>(entity);
public sealed class PlantHolderSystem : EntitySystem
{
+ [Dependency] private readonly AtmosphereSystem _atmosphere = default!;
[Dependency] private readonly BotanySystem _botany = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly MutationSystem _mutation = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
- [Dependency] private readonly TagSystem _tagSystem = default!;
+ [Dependency] private readonly SharedPointLightSystem _pointLight = default!;
[Dependency] private readonly SolutionContainerSystem _solutionSystem = default!;
+ [Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!;
- [Dependency] private readonly AtmosphereSystem _atmosphere = default!;
+
public const float HydroponicsSpeedMultiplier = 1f;
public const float HydroponicsConsumptionMultiplier = 2f;
if (component.Seed != null && component.Seed.Bioluminescent)
{
var light = EnsureComp<PointLightComponent>(uid);
- light.Radius = component.Seed.BioluminescentRadius;
- light.Color = component.Seed.BioluminescentColor;
- light.CastShadows = false; // this is expensive, and botanists make lots of plants
+ _pointLight.SetRadius(uid, component.Seed.BioluminescentRadius, light);
+ _pointLight.SetColor(uid, component.Seed.BioluminescentColor, light);
+ _pointLight.SetCastShadows(uid, false, light);
Dirty(uid, light);
}
else
[Dependency] private readonly AmbientSoundSystem _ambientSoundSystem = default!;
[Dependency] private readonly GravitySystem _gravitySystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
+ [Dependency] private readonly SharedPointLightSystem _lights = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
public override void Initialize()
var appearance = EntityManager.GetComponentOrNull<AppearanceComponent>(uid);
_appearance.SetData(uid, GravityGeneratorVisuals.Charge, grav.Charge, appearance);
- if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLight))
+ if (_lights.TryGetLight(uid, out var pointLight))
{
- pointLight.Enabled = grav.Charge > 0;
- pointLight.Radius = MathHelper.Lerp(grav.LightRadiusMin, grav.LightRadiusMax, grav.Charge);
+ _lights.SetEnabled(uid, grav.Charge > 0, pointLight);
+ _lights.SetRadius(uid, MathHelper.Lerp(grav.LightRadiusMin, grav.LightRadiusMax, grav.Charge), pointLight);
}
if (!grav.Intact)
using Content.Shared.Light;
using Content.Shared.Light.Components;
using Robust.Server.GameObjects;
-using Robust.Shared.GameStates;
using Color = Robust.Shared.Maths.Color;
namespace Content.Server.Light.EntitySystems;
if (CompOrNull<StationMemberComponent>(xform.GridUid)?.Station != ev.Station)
continue;
- pointLight.Color = details.EmergencyLightColor;
+ _pointLight.SetColor(uid, details.EmergencyLightColor, pointLight);
_appearance.SetData(uid, EmergencyLightVisuals.Color, details.EmergencyLightColor, appearance);
if (details.ForceEnableEmergencyLights && !light.ForciblyEnabled)
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
+using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Server.Light.EntitySystems
{
- [UsedImplicitly]
public sealed class HandheldLightSystem : SharedHandheldLightSystem
{
+ [Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly ActionsSystem _actions = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly PowerCellSystem _powerCell = default!;
- [Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
+ [Dependency] private readonly SharedAudioSystem _audio = default!;
+ [Dependency] private readonly SharedPointLightSystem _lights = default!;
// TODO: Ideally you'd be able to subscribe to power stuff to get events at certain percentages.. or something?
// But for now this will be better anyway.
public bool TurnOff(EntityUid uid, HandheldLightComponent component, bool makeNoise = true)
{
- if (!component.Activated || !TryComp<PointLightComponent>(uid, out var pointLightComponent))
+ if (!component.Activated || !_lights.TryGetLight(uid, out var pointLightComponent))
{
return false;
}
- pointLightComponent.Enabled = false;
+ _lights.SetEnabled(uid, false, pointLightComponent);
SetActivated(uid, false, component, makeNoise);
component.Level = null;
_activeLights.Remove(component);
public bool TurnOn(EntityUid user, EntityUid uid, HandheldLightComponent component)
{
- if (component.Activated || !TryComp<PointLightComponent>(uid, out var pointLightComponent))
+ if (component.Activated || !_lights.TryGetLight(uid, out var pointLightComponent))
{
return false;
}
return false;
}
- pointLightComponent.Enabled = true;
+ _lights.SetEnabled(uid, true, pointLightComponent);
SetActivated(uid, true, component, true);
_activeLights.Add(component);
using Content.Server.Light.Components;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
-using Robust.Server.GameObjects;
namespace Content.Server.Light.EntitySystems
{
public sealed class LitOnPoweredSystem : EntitySystem
{
+ [Dependency] private readonly SharedPointLightSystem _lights = default!;
+
public override void Initialize()
{
base.Initialize();
private void OnPowerChanged(EntityUid uid, LitOnPoweredComponent component, ref PowerChangedEvent args)
{
- if (EntityManager.TryGetComponent<PointLightComponent>(uid, out var light))
+ if (_lights.TryGetLight(uid, out var light))
{
- light.Enabled = args.Powered;
+ _lights.SetEnabled(uid, args.Powered, light);
}
}
private void OnPowerSupply(EntityUid uid, LitOnPoweredComponent component, ref PowerNetBatterySupplyEvent args)
{
- if (EntityManager.TryGetComponent<PointLightComponent>(uid, out var light))
+ if (_lights.TryGetLight(uid, out var light))
{
- light.Enabled = args.Supply;
+ _lights.SetEnabled(uid, args.Supply, light);
}
}
}
public sealed class MatchstickSystem : EntitySystem
{
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
- [Dependency] private readonly TransformSystem _transformSystem = default!;
- [Dependency] private readonly SharedItemSystem _item = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
+ [Dependency] private readonly SharedItemSystem _item = default!;
+ [Dependency] private readonly SharedPointLightSystem _lights = default!;
+ [Dependency] private readonly TransformSystem _transformSystem = default!;
private HashSet<MatchstickComponent> _litMatches = new();
{
component.CurrentState = value;
- if (TryComp<PointLightComponent>(component.Owner, out var pointLightComponent))
+ if (_lights.TryGetLight(uid, out var pointLightComponent))
{
- pointLightComponent.Enabled = component.CurrentState == SmokableState.Lit;
+ _lights.SetEnabled(uid, component.CurrentState == SmokableState.Lit, pointLightComponent);
}
- if (EntityManager.TryGetComponent(component.Owner, out ItemComponent? item))
+ if (EntityManager.TryGetComponent(uid, out ItemComponent? item))
{
switch (component.CurrentState)
{
case SmokableState.Lit:
- _item.SetHeldPrefix(component.Owner, "lit", item);
+ _item.SetHeldPrefix(uid, "lit", item);
break;
default:
- _item.SetHeldPrefix(component.Owner, "unlit", item);
+ _item.SetHeldPrefix(uid, "unlit", item);
break;
}
}
- if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance))
+ if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
{
_appearance.SetData(uid, SmokingVisuals.Smoking, component.CurrentState, appearance);
}
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
+ [Dependency] private readonly PointLightSystem _pointLight = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
private static readonly TimeSpan ThunkDelay = TimeSpan.FromSeconds(2);
private void OnMapInit(EntityUid uid, PoweredLightComponent light, MapInitEvent args)
{
+ // TODO: Use ContainerFill dog
if (light.HasLampOnSpawn != null)
{
- var entity = EntityManager.SpawnEntity(light.HasLampOnSpawn, EntityManager.GetComponent<TransformComponent>(light.Owner).Coordinates);
+ var entity = EntityManager.SpawnEntity(light.HasLampOnSpawn, EntityManager.GetComponent<TransformComponent>(uid).Coordinates);
light.LightBulbContainer.Insert(entity);
}
// need this to update visualizers
if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLight))
{
- pointLight.Enabled = value;
+ _pointLight.SetEnabled(uid, value, pointLight);
if (color != null)
- pointLight.Color = color.Value;
+ _pointLight.SetColor(uid, color.Value, pointLight);
if (radius != null)
- pointLight.Radius = (float) radius;
+ _pointLight.SetRadius(uid, (float) radius, pointLight);
if (energy != null)
- pointLight.Energy = (float) energy;
+ _pointLight.SetEnergy(uid, (float) energy, pointLight);
if (softness != null)
- pointLight.Softness = (float) softness;
+ _pointLight.SetSoftness(uid, (float) softness, pointLight);
}
}
using Content.Shared.Mind.Components;
using Content.Shared.Toggleable;
using Content.Shared.Verbs;
-using Robust.Server.GameObjects;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
{
public sealed class UnpoweredFlashlightSystem : EntitySystem
{
+ [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
- [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
+ [Dependency] private readonly SharedPointLightSystem _light = default!;
public override void Initialize()
{
private void OnGotEmagged(EntityUid uid, UnpoweredFlashlightComponent component, ref GotEmaggedEvent args)
{
- if (!TryComp<PointLightComponent>(uid, out var light))
+ if (!_light.TryGetLight(uid, out var light))
return;
if (_prototypeManager.TryIndex<ColorPalettePrototype>(component.EmaggedColorsPrototype, out var possibleColors))
{
var pick = _random.Pick(possibleColors.Colors.Values);
- light.Color = pick;
+ _light.SetColor(uid, pick, light);
}
args.Repeatable = true;
public void ToggleLight(EntityUid uid, UnpoweredFlashlightComponent flashlight)
{
- if (!TryComp<PointLightComponent>(uid, out var light))
+ if (!_light.TryGetLight(uid, out var light))
return;
flashlight.LightOn = !flashlight.LightOn;
- light.Enabled = flashlight.LightOn;
+ _light.SetEnabled(uid, flashlight.LightOn, light);
_appearance.SetData(uid, UnpoweredFlashlightVisuals.LightOn, flashlight.LightOn);
_appearance.SetData(uid, TegVisuals.CirculatorSpeed, speed);
_appearance.SetData(uid, TegVisuals.CirculatorPower, powered);
- if (TryComp(uid, out PointLightComponent? pointLight))
+ if (_pointLight.TryGetLight(uid, out var pointLight))
{
_pointLight.SetEnabled(uid, powered, pointLight);
- pointLight.Color = speed == TegCirculatorSpeed.SpeedFast ? circ.LightColorFast : circ.LightColorSlow;
+ _pointLight.SetColor(uid, speed == TegCirculatorSpeed.SpeedFast ? circ.LightColorFast : circ.LightColorSlow, pointLight);
}
}
-using System.Linq;
using System.Numerics;
using Content.Server.Audio;
using Content.Server.Construction;
using Content.Shared.Physics;
using Content.Shared.Shuttles.Components;
using Content.Shared.Temperature;
-using Robust.Server.GameObjects;
using Robust.Shared.Map;
-using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Collision.Shapes;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
[Dependency] private readonly AmbientSoundSystem _ambient = default!;
[Dependency] private readonly FixtureSystem _fixtureSystem = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
+ [Dependency] private readonly SharedPointLightSystem _light = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
// Essentially whenever thruster enables we update the shuttle's available impulses which are used for movement.
_appearance.SetData(uid, ThrusterVisualState.State, true, appearance);
}
- if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLightComponent))
+ if (_light.TryGetLight(uid, out var pointLightComponent))
{
- pointLightComponent.Enabled = true;
+ _light.SetEnabled(uid, true, pointLightComponent);
}
_ambient.SetAmbience(uid, true);
_appearance.SetData(uid, ThrusterVisualState.State, false, appearance);
}
- if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLightComponent))
+ if (_light.TryGetLight(uid, out var pointLightComponent))
{
- pointLightComponent.Enabled = false;
+ _light.SetEnabled(uid, false, pointLightComponent);
}
_ambient.SetAmbience(uid, false);
public sealed class ContainmentFieldGeneratorSystem : EntitySystem
{
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
- [Dependency] private readonly TagSystem _tags = default!;
- [Dependency] private readonly PopupSystem _popupSystem = default!;
- [Dependency] private readonly PhysicsSystem _physics = default!;
[Dependency] private readonly AppearanceSystem _visualizer = default!;
+ [Dependency] private readonly PhysicsSystem _physics = default!;
+ [Dependency] private readonly PopupSystem _popupSystem = default!;
+ [Dependency] private readonly SharedPointLightSystem _light = default!;
+ [Dependency] private readonly TagSystem _tags = default!;
public override void Initialize()
{
/// </summary>
public void UpdateConnectionLights(ContainmentFieldGeneratorComponent component)
{
- if (EntityManager.TryGetComponent<PointLightComponent>(component.Owner, out var pointLightComponent))
+ if (_light.TryGetLight(component.Owner, out var pointLightComponent))
{
- pointLightComponent.Enabled = component.Connections.Count > 0;
+ _light.SetEnabled(component.Owner, component.Connections.Count > 0, pointLightComponent);
}
}
{
public sealed partial class ToolSystem
{
- [Dependency] private readonly IEntityManager _entityManager = default!;
-
- [Dependency] private readonly AppearanceSystem _appearanceSystem = default!;
- [Dependency] private readonly SharedAudioSystem _audioSystem = default!;
-
private readonly HashSet<EntityUid> _activeWelders = new();
private const float WelderUpdateTimer = 1f;
WelderComponent? welder = null,
SolutionContainerManagerComponent? solutionContainer = null,
ItemComponent? item = null,
- PointLightComponent? light = null,
+ SharedPointLightComponent? light = null,
AppearanceComponent? appearance = null)
{
// Right now, we only need the welder.
WelderComponent? welder = null,
SolutionContainerManagerComponent? solutionContainer = null,
ItemComponent? item = null,
- PointLightComponent? light = null,
+ SharedPointLightComponent? light = null,
AppearanceComponent? appearance = null,
TransformComponent? transform = null)
{
return false;
// Optional components.
- Resolve(uid, ref item, ref light, ref appearance, false);
+ Resolve(uid, ref item,ref appearance, false);
+
+ _light.ResolveLight(uid, ref light);
if (!_solutionContainerSystem.TryGetSolution(uid, welder.FuelSolution, out var solution, solutionContainer))
return false;
_appearanceSystem.SetData(uid, ToggleableLightVisuals.Enabled, true);
if (light != null)
- light.Enabled = true;
+ {
+ _light.SetEnabled(uid, true, light);
+ }
_audioSystem.PlayPvs(welder.WelderOnSounds, uid, AudioParams.Default.WithVariation(0.125f).WithVolume(-5f));
_atmosphereSystem.HotspotExpose(gridUid, position, 700, 50, uid, true);
}
- _entityManager.Dirty(welder);
+ Dirty(uid, welder);
_activeWelders.Add(uid);
return true;
public bool TryTurnWelderOff(EntityUid uid, EntityUid? user,
WelderComponent? welder = null,
ItemComponent? item = null,
- PointLightComponent? light = null,
+ SharedPointLightComponent? light = null,
AppearanceComponent? appearance = null)
{
if (!Resolve(uid, ref welder))
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(uid):welder} toggled off");
var ev = new WelderToggledEvent(false);
- RaiseLocalEvent(welder.Owner, ev, false);
+ RaiseLocalEvent(uid, ev, false);
var hotEvent = new IsHotEvent() {IsHot = false};
RaiseLocalEvent(uid, hotEvent);
_appearanceSystem.SetData(uid, ToggleableLightVisuals.Enabled, false);
if (light != null)
- light.Enabled = false;
+ {
+ _light.SetEnabled(uid, false, light);
+ }
_audioSystem.PlayPvs(welder.WelderOffSounds, uid, AudioParams.Default.WithVariation(0.125f).WithVolume(-5f));
- _entityManager.Dirty(welder);
+ Dirty(uid, welder);
_activeWelders.Remove(uid);
return true;
private void OnWelderStartup(EntityUid uid, WelderComponent welder, ComponentStartup args)
{
- _entityManager.Dirty(welder);
+ // TODO: Delete this shit what
+ Dirty(welder);
}
private void OnWelderIsHotEvent(EntityUid uid, WelderComponent welder, IsHotEvent args)
private void OnWelderSolutionChange(EntityUid uid, WelderComponent welder, SolutionChangedEvent args)
{
- _entityManager.Dirty(welder);
+ // TODO what
+ // ????
+ Dirty(welder);
}
private void OnWelderActivate(EntityUid uid, WelderComponent welder, ActivateInWorldEvent args)
if (solution.GetTotalPrototypeQuantity(welder.FuelReagent) <= FixedPoint2.Zero)
TryTurnWelderOff(tool, null, welder);
- _entityManager.Dirty(welder);
+ Dirty(welder);
}
_welderTimer -= WelderUpdateTimer;
// TODO move tool system to shared, and make it a friend of Tool Component.
public sealed partial class ToolSystem : SharedToolSystem
{
- [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
- [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
+ [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
+ [Dependency] private readonly AppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
+ [Dependency] private readonly SharedAudioSystem _audioSystem = default!;
+ [Dependency] private readonly SharedPointLightSystem _light = default!;
+ [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly TurfSystem _turf = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
+ [Dependency] private readonly SharedPointLightSystem _light = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
public override void Initialize()
{
if (!Resolve(uid, ref cryoPod))
return;
+
var cryoPodEnabled = HasComp<ActiveCryoPodComponent>(uid);
- if (TryComp<SharedPointLightComponent>(uid, out var light))
+
+ if (_light.TryGetLight(uid, out var light))
{
- light.Enabled = cryoPodEnabled && cryoPod.BodyContainer.ContainedEntity != null;
+ _light.SetEnabled(uid, cryoPodEnabled && cryoPod.BodyContainer.ContainedEntity != null, light);
}
if (!Resolve(uid, ref appearance))
return;
+
_appearanceSystem.SetData(uid, CryoPodComponent.CryoPodVisuals.ContainsEntity, cryoPod.BodyContainer.ContainedEntity == null, appearance);
_appearanceSystem.SetData(uid, CryoPodComponent.CryoPodVisuals.IsOn, cryoPodEnabled, appearance);
}
var enumerator = EntityQueryEnumerator<RevenantOverloadedLightsComponent>();
- while (enumerator.MoveNext(out var comp))
+ while (enumerator.MoveNext(out var uid, out var comp))
{
comp.Accumulator += frameTime;
continue;
OnZap(comp);
- RemComp(comp.Owner, comp);
+ RemCompDeferred(uid, comp);
}
}
if (TryComp(uid, out SharedPullableComponent? pullable))
_pulling.TryStopPull(pullable);
- if (TryComp(uid, out SharedPointLightComponent? light))
- _pointLight.SetEnabled(uid, isDeployed, light);
+ SharedPointLightComponent? pointLight = null;
+ if (_pointLight.ResolveLight(uid, ref pointLight))
+ {
+ _pointLight.SetEnabled(uid, isDeployed, pointLight);
+ }
}
}