Fix a few warnings (#11576)

This commit is contained in:
metalgearsloth
2022-10-04 14:24:19 +11:00
committed by GitHub
parent a6d20803a6
commit 600c0e3255
43 changed files with 185 additions and 167 deletions

View File

@@ -26,7 +26,7 @@ namespace Content.Client.Atmos.UI
{
base.Open();
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
var atmosSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AtmosphereSystem>();
_window = new GasFilterWindow(atmosSystem.Gases);
@@ -59,7 +59,7 @@ namespace Content.Client.Atmos.UI
private void OnSelectGasPressed()
{
if (_window is null || _window.SelectedGas is null) return;
if (!Int32.TryParse(_window.SelectedGas, out var gas)) return;
if (!int.TryParse(_window.SelectedGas, out var gas)) return;
SendMessage(new GasFilterSelectGasMessage(gas));
}
@@ -78,7 +78,7 @@ namespace Content.Client.Atmos.UI
_window.SetTransferRate(cast.TransferRate);
if (cast.FilteredGas is not null)
{
var atmos = EntitySystem.Get<AtmosphereSystem>();
var atmos = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AtmosphereSystem>();
var gas = atmos.GetGas((Gas) cast.FilteredGas);
_window.SetGasFiltered(gas.ID, gas.Name);
}

View File

@@ -24,7 +24,8 @@ namespace Content.Client.Audio
/// </summary>
public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
{
[Dependency] private EntityLookupSystem _lookup = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
@@ -43,7 +44,7 @@ namespace Content.Client.Audio
/// </summary>
private int MaxSingleSound => (int) (_maxAmbientCount / (16.0f / 6.0f));
private Dictionary<AmbientSoundComponent, (IPlayingAudioStream? Stream, string Sound)> _playingSounds = new();
private readonly Dictionary<AmbientSoundComponent, (IPlayingAudioStream? Stream, string Sound)> _playingSounds = new();
private const float RangeBuffer = 3f;
@@ -58,7 +59,7 @@ namespace Content.Client.Audio
if (_overlayEnabled)
{
_overlay = new AmbientSoundOverlay(EntityManager, this, Get<EntityLookupSystem>());
_overlay = new AmbientSoundOverlay(EntityManager, this, EntityManager.System<EntityLookupSystem>());
overlayManager.AddOverlay(_overlay);
}
else
@@ -119,7 +120,8 @@ namespace Content.Client.Audio
foreach (var (_, (_, sound)) in _playingSounds)
{
if (sound.Equals(countSound)) count++;
if (sound.Equals(countSound))
count++;
}
return count;
@@ -180,7 +182,7 @@ namespace Content.Client.Audio
continue;
}
var key = ambientComp.Sound.GetSound();
var key = _audio.GetSound(ambientComp.Sound);
if (!sourceDict.ContainsKey(key))
sourceDict[key] = new List<AmbientSoundComponent>(MaxSingleSound);
@@ -188,6 +190,7 @@ namespace Content.Client.Audio
sourceDict[key].Add(ambientComp);
}
// TODO: Just store the distance from above...
foreach (var (key, val) in sourceDict)
{
sourceDict[key] = val.OrderByDescending(x =>
@@ -236,7 +239,7 @@ namespace Content.Client.Audio
if (_playingSounds.ContainsKey(comp))
continue;
var sound = comp.Sound.GetSound();
var sound = _audio.GetSound(comp.Sound);
if (PlayingCount(sound) >= MaxSingleSound)
{
@@ -250,7 +253,7 @@ namespace Content.Client.Audio
continue;
}
var audioParams = AudioHelpers
var audioParams = AudioParams.Default
.WithVariation(0.01f)
.WithVolume(comp.Volume + _ambienceVolume)
.WithLoop(true)
@@ -259,9 +262,7 @@ namespace Content.Client.Audio
.WithPlayOffset(_random.NextFloat(0.0f, 100.0f))
.WithMaxDistance(comp.Range);
var stream = SoundSystem.Play(sound,
Filter.Local(),
comp.Owner, audioParams);
var stream = _audio.PlayPvs(comp.Sound, comp.Owner, audioParams);
if (stream == null) continue;

View File

@@ -30,6 +30,7 @@ namespace Content.Client.Audio
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly ClientGameTicker _gameTicker = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
private readonly AudioParams _ambientParams = new(-10f, 1, "Master", 0, 0, 0, true, 0f);
private readonly AudioParams _lobbyParams = new(-5f, 1, "Master", 0, 0, 0, true, 0f);
@@ -211,7 +212,8 @@ namespace Content.Client.Audio
return;
_playingCollection = _currentCollection;
var file = _robustRandom.Pick(_currentCollection.PickFiles).ToString();
_ambientStream = SoundSystem.Play(file, Filter.Local(), _ambientParams.WithVolume(_ambientParams.Volume + _configManager.GetCVar(CCVars.AmbienceVolume)));
_ambientStream = _audio.PlayGlobal(file, Filter.Local(),
_ambientParams.WithVolume(_ambientParams.Volume + _configManager.GetCVar(CCVars.AmbienceVolume)));
}
private void EndAmbience()
@@ -304,7 +306,8 @@ namespace Content.Client.Audio
{
return;
}
_lobbyStream = SoundSystem.Play(file, Filter.Local(), _lobbyParams);
_lobbyStream = _audio.PlayGlobal(file, Filter.Local(), _lobbyParams);
}
private void EndLobbyMusic()

View File

@@ -10,6 +10,7 @@ namespace Content.Client.Audio;
public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
{
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
// Admin music
private bool _adminAudioEnabled = true;
@@ -64,7 +65,7 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
{
if(!_adminAudioEnabled) return;
var stream = SoundSystem.Play(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
_adminAudio.Add(stream);
}
@@ -73,13 +74,13 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
// Either the cvar is disabled or it's already playing
if(!_eventAudioEnabled || _eventAudio.ContainsKey(soundEvent.Type)) return;
var stream = SoundSystem.Play(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
_eventAudio.Add(soundEvent.Type, stream);
}
private void PlayGameSound(GameGlobalSoundEvent soundEvent)
{
SoundSystem.Play(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
_audio.PlayGlobal(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
}
private void StopStationEventMusic(StopStationEventMusic soundEvent)

View File

@@ -16,8 +16,12 @@ public sealed class CargoShuttleConsoleBoundUserInterface : BoundUserInterface
protected override void Open()
{
base.Open();
_menu = new CargoShuttleMenu(IoCManager.Resolve<IGameTiming>(), IoCManager.Resolve<IPrototypeManager>(), EntitySystem.Get<SpriteSystem>());
var collection = IoCManager.Instance;
if (collection == null)
return;
_menu = new CargoShuttleMenu(collection.Resolve<IGameTiming>(), collection.Resolve<IPrototypeManager>(), collection.Resolve<IEntitySystemManager>().GetEntitySystem<SpriteSystem>());
_menu.ShuttleCallRequested += OnShuttleCall;
_menu.ShuttleRecallRequested += OnShuttleRecall;
_menu.OnClose += Close;

View File

@@ -16,7 +16,7 @@ namespace Content.Client.CharacterInfo.Components
public void Opened()
{
EntitySystem.Get<CharacterInfoSystem>().RequestCharacterInfo(Owner);
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<CharacterInfoSystem>().RequestCharacterInfo(Owner);
}
public sealed class CharacterInfoControl : BoxContainer

View File

@@ -10,6 +10,8 @@ namespace Content.Client.CharacterInfo.Components;
public sealed class CharacterInfoSystem : EntitySystem
{
[Dependency] private readonly SpriteSystem _sprite = default!;
public override void Initialize()
{
base.Initialize();
@@ -71,7 +73,7 @@ public sealed class CharacterInfoSystem : EntitySystem
};
hbox.AddChild(new ProgressTextureRect
{
Texture = objectiveCondition.SpriteSpecifier.Frame0(),
Texture = _sprite.Frame0(objectiveCondition.SpriteSpecifier),
Progress = objectiveCondition.Progress,
VerticalAlignment = Control.VAlignment.Center
});

View File

@@ -478,7 +478,7 @@ namespace Content.Client.Chat.UI
UpdateChannelSelectButton();
// Warn typing indicator about change
EntitySystem.Get<TypingIndicatorSystem>().ClientChangedChatText();
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TypingIndicatorSystem>().ClientChangedChatText();
}
private static ChatSelectChannel GetChannelFromPrefix(char prefix)
@@ -523,7 +523,7 @@ namespace Content.Client.Chat.UI
private void Input_OnTextEntered(LineEdit.LineEditEventArgs args)
{
// Warn typing indicator about entered text
EntitySystem.Get<TypingIndicatorSystem>().ClientSubmittedChatText();
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TypingIndicatorSystem>().ClientSubmittedChatText();
if (!string.IsNullOrWhiteSpace(args.Text))
{

View File

@@ -28,7 +28,7 @@ namespace Content.Client.Stack
// TODO PREDICT ENTITY DELETION: This should really just be a normal entity deletion call.
if (component.Count <= 0)
{
Transform(uid).DetachParentToNull();
Xform.DetachParentToNull(Transform(uid));
return;
}

View File

@@ -20,6 +20,7 @@ namespace Content.Client.Suspicion
[GenerateTypedNameReferences]
public sealed partial class SuspicionGui : UIWidget
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;
@@ -66,7 +67,7 @@ namespace Content.Client.Suspicion
return false;
}
return IoCManager.Resolve<IEntityManager>().TryGetComponent(_playerManager.LocalPlayer.ControlledEntity, out suspicion);
return _entManager.TryGetComponent(_playerManager.LocalPlayer.ControlledEntity, out suspicion);
}
public void UpdateLabel()
@@ -83,7 +84,7 @@ namespace Content.Client.Suspicion
return;
}
var endTime = EntitySystem.Get<SuspicionEndTimerSystem>().EndTime;
var endTime = _entManager.System<SuspicionEndTimerSystem>().EndTime;
if (endTime == null)
{
TimerLabel.Visible = false;

View File

@@ -27,6 +27,7 @@ namespace Content.Client.Tabletop
[Dependency] private readonly IUserInterfaceManager _uiManger = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
// Time in seconds to wait until sending the location of a dragged entity to the server again
private const float Delay = 1f / 10; // 10 Hz
@@ -219,8 +220,8 @@ namespace Content.Client.Tabletop
if (EntityManager.TryGetComponent<AppearanceComponent>(draggedEntity, out var appearance))
{
appearance.SetData(TabletopItemVisuals.Scale, new Vector2(1.25f, 1.25f));
appearance.SetData(TabletopItemVisuals.DrawDepth, (int) DrawDepth.Items + 1);
_appearance.SetData(draggedEntity, TabletopItemVisuals.Scale, new Vector2(1.25f, 1.25f), appearance);
_appearance.SetData(draggedEntity, TabletopItemVisuals.DrawDepth, (int) DrawDepth.Items + 1, appearance);
}
_draggedEntity = draggedEntity;

View File

@@ -52,7 +52,8 @@ namespace Content.Client.VendingMachines.UI
}
var longestEntry = string.Empty;
var spriteSystem = EntitySystem.Get<SpriteSystem>();
var spriteSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SpriteSystem>();
for (var i = 0; i < inventory.Count; i++)
{
var entry = inventory[i];

View File

@@ -22,7 +22,7 @@ namespace Content.Client.VendingMachines
base.Open();
var entMan = IoCManager.Resolve<IEntityManager>();
var vendingMachineSys = EntitySystem.Get<VendingMachineSystem>();
var vendingMachineSys = entMan.System<VendingMachineSystem>();
_cachedInventory = vendingMachineSys.GetAllInventory(Owner.Owner);
@@ -50,7 +50,7 @@ namespace Content.Client.VendingMachines
private void OnItemSelected(ItemList.ItemListSelectedEventArgs args)
{
if (_cachedInventory == null || _cachedInventory.Count == 0)
if (_cachedInventory.Count == 0)
return;
var selectedItem = _cachedInventory.ElementAtOrDefault(args.ItemIndex);

View File

@@ -24,7 +24,7 @@ namespace Content.Client.Verbs.UI
public bool TextVisible { set => Label.Visible = value; }
// Top quality variable naming
public Verb? Verb;
public readonly Verb? Verb;
public VerbMenuElement(Verb verb) : base(verb.Text)
{
@@ -41,12 +41,14 @@ namespace Content.Client.Verbs.UI
ExpansionIndicator.Visible = true;
}
var entManager = IoCManager.Resolve<IEntityManager>();
if (verb.Icon == null && verb.IconEntity != null)
{
var spriteView = new SpriteView()
{
OverrideDirection = Direction.South,
Sprite = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ISpriteComponent>(verb.IconEntity.Value)
Sprite = entManager.GetComponentOrNull<ISpriteComponent>(verb.IconEntity.Value)
};
Icon.AddChild(spriteView);
@@ -55,7 +57,7 @@ namespace Content.Client.Verbs.UI
Icon.AddChild(new TextureRect()
{
Texture = verb.Icon?.Frame0(),
Texture = verb.Icon != null ? entManager.System<SpriteSystem>().Frame0(verb.Icon) : null,
Stretch = TextureRect.StretchMode.KeepAspectCentered
});
}
@@ -66,7 +68,7 @@ namespace Content.Client.Verbs.UI
Icon.AddChild(new TextureRect()
{
Texture = category.Icon?.Frame0(),
Texture = category.Icon != null ? IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SpriteSystem>().Frame0(category.Icon) : null,
Stretch = TextureRect.StretchMode.KeepAspectCentered
});
}

View File

@@ -4,6 +4,7 @@ using System.Linq;
using Content.Shared.Voting;
using Robust.Client;
using Robust.Client.Console;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Network;
@@ -117,7 +118,8 @@ namespace Content.Client.Voting
}
@new = true;
SoundSystem.Play("/Audio/Effects/voteding.ogg", Filter.Local());
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>()
.PlayGlobal("/Audio/Effects/voteding.ogg", Filter.Local());
// New vote from the server.
var vote = new ActiveVote(voteId)