Remove lights compref (#19531)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user