Remove lights compref (#19531)

This commit is contained in:
metalgearsloth
2023-09-11 19:18:06 +10:00
committed by GitHub
parent d315ce3c8c
commit 99b77bc2d3
64 changed files with 222 additions and 132 deletions

View File

@@ -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);

View File

@@ -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