Remove lights compref (#19531)
This commit is contained in:
@@ -156,7 +156,7 @@ public sealed partial class AnomalySystem
|
||||
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.
|
||||
|
||||
@@ -26,11 +26,12 @@ namespace Content.Server.Botany.Systems;
|
||||
|
||||
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!;
|
||||
@@ -181,17 +182,17 @@ public sealed partial class BotanySystem : EntitySystem
|
||||
|
||||
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);
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace Content.Server.Botany.Systems;
|
||||
|
||||
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!;
|
||||
@@ -36,10 +37,11 @@ public sealed class PlantHolderSystem : EntitySystem
|
||||
[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;
|
||||
@@ -856,9 +858,9 @@ public sealed class PlantHolderSystem : EntitySystem
|
||||
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
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Content.Server.Gravity
|
||||
[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()
|
||||
@@ -233,10 +234,10 @@ namespace Content.Server.Gravity
|
||||
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)
|
||||
|
||||
@@ -9,7 +9,6 @@ using Content.Shared.Examine;
|
||||
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;
|
||||
@@ -103,7 +102,7 @@ public sealed class EmergencyLightSystem : SharedEmergencyLightSystem
|
||||
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)
|
||||
|
||||
@@ -13,18 +13,20 @@ using JetBrains.Annotations;
|
||||
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.
|
||||
@@ -196,12 +198,12 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
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);
|
||||
@@ -210,7 +212,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -233,7 +235,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
return false;
|
||||
}
|
||||
|
||||
pointLightComponent.Enabled = true;
|
||||
_lights.SetEnabled(uid, true, pointLightComponent);
|
||||
SetActivated(uid, true, component, true);
|
||||
_activeLights.Add(component);
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
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();
|
||||
@@ -16,17 +17,17 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,10 @@ namespace Content.Server.Light.EntitySystems
|
||||
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();
|
||||
|
||||
@@ -92,25 +93,25 @@ namespace Content.Server.Light.EntitySystems
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
[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);
|
||||
@@ -74,9 +75,10 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
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
|
||||
@@ -386,16 +388,16 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ using Content.Shared.Light.Components;
|
||||
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;
|
||||
@@ -16,11 +15,12 @@ namespace Content.Server.Light.EntitySystems
|
||||
{
|
||||
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()
|
||||
{
|
||||
@@ -71,13 +71,13 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
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;
|
||||
@@ -86,11 +86,11 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -270,10 +270,10 @@ public sealed class TegSystem : EntitySystem
|
||||
_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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Server.Audio;
|
||||
using Content.Server.Construction;
|
||||
@@ -12,9 +11,7 @@ using Content.Shared.Maps;
|
||||
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;
|
||||
@@ -32,6 +29,7 @@ public sealed class ThrusterSystem : EntitySystem
|
||||
[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.
|
||||
@@ -287,9 +285,9 @@ public sealed class ThrusterSystem : EntitySystem
|
||||
_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);
|
||||
@@ -376,9 +374,9 @@ public sealed class ThrusterSystem : EntitySystem
|
||||
_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);
|
||||
|
||||
@@ -18,10 +18,11 @@ namespace Content.Server.Singularity.EntitySystems;
|
||||
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()
|
||||
{
|
||||
@@ -325,9 +326,9 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
|
||||
/// </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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,11 +22,6 @@ namespace Content.Server.Tools
|
||||
{
|
||||
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;
|
||||
@@ -65,7 +60,7 @@ namespace Content.Server.Tools
|
||||
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.
|
||||
@@ -82,7 +77,7 @@ namespace Content.Server.Tools
|
||||
WelderComponent? welder = null,
|
||||
SolutionContainerManagerComponent? solutionContainer = null,
|
||||
ItemComponent? item = null,
|
||||
PointLightComponent? light = null,
|
||||
SharedPointLightComponent? light = null,
|
||||
AppearanceComponent? appearance = null,
|
||||
TransformComponent? transform = null)
|
||||
{
|
||||
@@ -90,7 +85,9 @@ namespace Content.Server.Tools
|
||||
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;
|
||||
@@ -125,7 +122,9 @@ namespace Content.Server.Tools
|
||||
_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));
|
||||
|
||||
@@ -135,7 +134,7 @@ namespace Content.Server.Tools
|
||||
_atmosphereSystem.HotspotExpose(gridUid, position, 700, 50, uid, true);
|
||||
}
|
||||
|
||||
_entityManager.Dirty(welder);
|
||||
Dirty(uid, welder);
|
||||
|
||||
_activeWelders.Add(uid);
|
||||
return true;
|
||||
@@ -144,7 +143,7 @@ namespace Content.Server.Tools
|
||||
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))
|
||||
@@ -162,7 +161,7 @@ namespace Content.Server.Tools
|
||||
_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);
|
||||
@@ -172,11 +171,13 @@ namespace Content.Server.Tools
|
||||
_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;
|
||||
@@ -184,7 +185,8 @@ namespace Content.Server.Tools
|
||||
|
||||
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)
|
||||
@@ -217,7 +219,9 @@ namespace Content.Server.Tools
|
||||
|
||||
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)
|
||||
@@ -310,7 +314,7 @@ namespace Content.Server.Tools
|
||||
if (solution.GetTotalPrototypeQuantity(welder.FuelReagent) <= FixedPoint2.Zero)
|
||||
TryTurnWelderOff(tool, null, welder);
|
||||
|
||||
_entityManager.Dirty(welder);
|
||||
Dirty(welder);
|
||||
}
|
||||
|
||||
_welderTimer -= WelderUpdateTimer;
|
||||
|
||||
@@ -12,11 +12,14 @@ namespace Content.Server.Tools
|
||||
// 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!;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user