Energy crystal (#243)
* init magic container system * charging and discharging * add energy regenerator * thaumaturgy glasses, scanning energy * add energy quartz prorotypes and sprites * light power controller * commit special for _des * simple normalizer crystal slot * YEEEEEEE BOIII, examined crystalls inside things * кристал теперь видно, когда он вставлен в стабилизатор * TryUseCharge приборами * hello deserty, how are you doing? * rename regenerator to EnergyDraw, allow draw from slot * normalizer жрет magic energy файналли * Update normalizer.yml * visual polishing * Update crystal.yml
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
using Content.Server._CP14.MagicEnergy;
|
||||
using Content.Server.Audio;
|
||||
using Content.Shared._CP14.MagicEnergy.Components;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
@@ -12,18 +16,35 @@ public sealed partial class CP14SolutionNormalizerSystem : EntitySystem
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
|
||||
[Dependency] private readonly CP14MagicEnergyCrystalSlotSystem _magicSlot = default!;
|
||||
[Dependency] private readonly AmbientSoundSystem _ambient = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<CP14SolutionNormalizerComponent,CP14SlotCrystalPowerChangedEvent>(OnSlotPowerChanged);
|
||||
}
|
||||
|
||||
private void OnSlotPowerChanged(Entity<CP14SolutionNormalizerComponent> ent, ref CP14SlotCrystalPowerChangedEvent args)
|
||||
{
|
||||
if (TryComp<AmbientSoundComponent>(ent, out var ambient))
|
||||
{
|
||||
_ambient.SetAmbience(ent, args.Powered);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
var query = EntityQueryEnumerator<CP14SolutionNormalizerComponent, SolutionContainerManagerComponent>();
|
||||
|
||||
while (query.MoveNext(out var uid, out var normalizer, out var containerManager))
|
||||
{
|
||||
if (_timing.CurTime <= normalizer.NextUpdateTime)
|
||||
continue;
|
||||
|
||||
if (!_magicSlot.HasEnergy(uid, 1))
|
||||
continue;
|
||||
|
||||
normalizer.NextUpdateTime = _timing.CurTime + normalizer.UpdateFrequency;
|
||||
|
||||
var solutionManager = new Entity<SolutionContainerManagerComponent?>(uid, containerManager);
|
||||
|
||||
Reference in New Issue
Block a user