Fix a bunch of warnings (#11965)

Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2022-10-17 02:44:23 +11:00
committed by GitHub
parent d1c1c8ada3
commit 5373fec641
17 changed files with 91 additions and 101 deletions

View File

@@ -3,6 +3,6 @@ using Robust.Shared.GameObjects;
namespace Content.Client.Atmos.Components;
[RegisterComponent]
public class PipeColorVisualsComponent : Component
public sealed class PipeColorVisualsComponent : Component
{
}

View File

@@ -17,8 +17,7 @@ namespace Content.Client.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
EntitySystem.Get<MarkerSystem>()
.MarkersVisible ^= true;
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<MarkerSystem>().MarkersVisible ^= true;
}
}
@@ -31,7 +30,7 @@ namespace Content.Client.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
EntitySystem.Get<SubFloorHideSystem>().ShowAll ^= true;
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SubFloorHideSystem>().ShowAll ^= true;
}
}
@@ -47,14 +46,11 @@ namespace Content.Client.Commands
EntitySystem.Get<SubFloorHideSystem>().ShowAll = true;
var entMan = IoCManager.Resolve<IEntityManager>();
var components = entMan.EntityQuery<SubFloorHideComponent>(true);
var components = entMan.EntityQuery<SubFloorHideComponent, SpriteComponent>(true);
foreach (var component in components)
foreach (var (_, sprite) in components)
{
if (entMan.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
{
sprite.DrawDepth = (int) DrawDepth.Overlays;
}
sprite.DrawDepth = (int) DrawDepth.Overlays;
}
}
}
@@ -69,7 +65,7 @@ namespace Content.Client.Commands
{
var message = args[0];
EntitySystem.Get<PopupSystem>().PopupCursor(message);
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<PopupSystem>().PopupCursor(message);
}
}
}

View File

@@ -90,7 +90,7 @@ namespace Content.Client.HealthOverlay.UI
var mobStateSystem = _entities.EntitySysManager.GetEntitySystem<MobStateSystem>();
FixedPoint2 threshold;
if (mobState.IsAlive())
if (mobStateSystem.IsAlive(mobState.Owner, mobState))
{
if (!mobStateSystem.TryGetEarliestCriticalState(mobState, damageable.TotalDamage, out _, out threshold))
{
@@ -104,7 +104,7 @@ namespace Content.Client.HealthOverlay.UI
HealthBar.Ratio = 1 - (damageable.TotalDamage / threshold).Float();
HealthBar.Visible = true;
}
else if (mobState.IsCritical())
else if (mobStateSystem.IsCritical(mobState.Owner, mobState))
{
HealthBar.Ratio = 0;
HealthBar.Visible = false;
@@ -121,7 +121,7 @@ namespace Content.Client.HealthOverlay.UI
((damageable.TotalDamage - critThreshold) /
(deadThreshold - critThreshold)).Float();
}
else if (mobState.IsDead())
else if (mobStateSystem.IsDead(mobState.Owner, mobState))
{
CritBar.Ratio = 0;
CritBar.Visible = false;
@@ -158,7 +158,8 @@ namespace Content.Client.HealthOverlay.UI
{
base.Dispose(disposing);
if (!disposing) return;
if (!disposing)
return;
HealthBar.Dispose();
}

View File

@@ -2,6 +2,6 @@ using Content.Shared.IdentityManagement;
namespace Content.Client.IdentityManagement;
public class IdentitySystem : SharedIdentitySystem
public sealed class IdentitySystem : SharedIdentitySystem
{
}

View File

@@ -16,7 +16,7 @@ public sealed class InfoSystem : EntitySystem
RaiseNetworkEvent(new RequestRulesMessage());
}
protected void OnRulesReceived(RulesMessage message, EntitySessionEventArgs eventArgs)
private void OnRulesReceived(RulesMessage message, EntitySessionEventArgs eventArgs)
{
Logger.DebugS("info", "Received server rules.");
Rules = message;

View File

@@ -11,8 +11,6 @@ namespace Content.Client.Info
public sealed class RulesAndInfoWindow : DefaultWindow
{
[Dependency] private readonly IResourceCache _resourceManager = default!;
[Dependency] private readonly IConfigurationManager _cfgManager = default!;
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
[Dependency] private readonly RulesManager _rules = default!;
public RulesAndInfoWindow()

View File

@@ -11,9 +11,6 @@ namespace Content.Client.Info;
[GenerateTypedNameReferences]
public sealed partial class RulesControl : BoxContainer
{
[Dependency] private readonly IResourceCache _resourceManager = default!;
[Dependency] private readonly IConfigurationManager _cfgManager = default!;
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
[Dependency] private readonly RulesManager _rules = default!;
public RulesControl()

View File

@@ -24,10 +24,7 @@ namespace Content.Client.Lobby
{
[Dependency] private readonly IBaseClient _baseClient = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
@@ -43,7 +40,7 @@ namespace Content.Client.Lobby
protected override void Startup()
{
_gameTicker = EntitySystem.Get<ClientGameTicker>();
_gameTicker = _entityManager.System<ClientGameTicker>();
_characterSetup = new CharacterSetupGui(_entityManager, _resourceCache, _preferencesManager,
_prototypeManager, _configurationManager);
LayoutContainer.SetAnchorPreset(_characterSetup, LayoutContainer.LayoutPreset.Wide);
@@ -113,10 +110,10 @@ namespace Content.Client.Lobby
public override void FrameUpdate(FrameEventArgs e)
{
if (_lobby == null) return;
if (_lobby == null)
return;
var gameTicker = EntitySystem.Get<ClientGameTicker>();
if (gameTicker.IsGameStarted)
if (_gameTicker.IsGameStarted)
{
_lobby.StartTime.Text = string.Empty;
_lobby.StationTime.Text = Loc.GetString("lobby-state-player-status-station-time", ("stationTime", _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan).ToString("hh\\:mm")));
@@ -125,13 +122,13 @@ namespace Content.Client.Lobby
string text;
if (gameTicker.Paused)
if (_gameTicker.Paused)
{
text = Loc.GetString("lobby-state-paused");
}
else
{
var difference = gameTicker.StartTime - _gameTiming.CurTime;
var difference = _gameTicker.StartTime - _gameTiming.CurTime;
var seconds = difference.TotalSeconds;
if (seconds < 0)
{
@@ -156,16 +153,15 @@ namespace Content.Client.Lobby
private void LobbyLateJoinStatusUpdated()
{
if (_lobby == null) return;
_lobby.ReadyButton.Disabled = EntitySystem.Get<ClientGameTicker>().DisallowedLateJoin;
_lobby.ReadyButton.Disabled = _gameTicker.DisallowedLateJoin;
}
private void UpdateLobbyUi()
{
if (_lobby == null) return;
if (_lobby == null)
return;
var gameTicker = EntitySystem.Get<ClientGameTicker>();
if (gameTicker.IsGameStarted)
if (_gameTicker.IsGameStarted)
{
_lobby.ReadyButton.Text = Loc.GetString("lobby-state-ready-button-join-state");
_lobby.ReadyButton.ToggleMode = false;
@@ -178,19 +174,21 @@ namespace Content.Client.Lobby
_lobby.ReadyButton.Text = Loc.GetString("lobby-state-ready-button-ready-up-state");
_lobby.ReadyButton.ToggleMode = true;
_lobby.ReadyButton.Disabled = false;
_lobby.ReadyButton.Pressed = gameTicker.AreWeReady;
_lobby.ReadyButton.Pressed = _gameTicker.AreWeReady;
_lobby.ObserveButton.Disabled = true;
}
if (gameTicker.ServerInfoBlob != null)
if (_gameTicker.ServerInfoBlob != null)
{
_lobby.ServerInfo.SetInfoBlob(gameTicker.ServerInfoBlob);
_lobby.ServerInfo.SetInfoBlob(_gameTicker.ServerInfoBlob);
}
}
private void UpdateLobbyBackground()
{
if (_lobby == null) return;
if (_lobby == null)
return;
if (_gameTicker.LobbyBackground != null)
{
_lobby.Background.Texture = _resourceCache.GetResource<TextureResource>(_gameTicker.LobbyBackground );
@@ -204,7 +202,7 @@ namespace Content.Client.Lobby
private void SetReady(bool newReady)
{
if (EntitySystem.Get<ClientGameTicker>().IsGameStarted)
if (_gameTicker.IsGameStarted)
{
return;
}

View File

@@ -11,6 +11,7 @@ namespace Content.Client.Pinpointer
public sealed class ClientPinpointerSystem : SharedPinpointerSystem
{
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly AppearanceSystem _appearance = default!;
public override void Initialize()
{
@@ -36,7 +37,9 @@ namespace Content.Client.Pinpointer
private void HandleCompState(EntityUid uid, PinpointerComponent pinpointer, ref ComponentHandleState args)
{
if (args.Current is not PinpointerComponentState state) return;
if (args.Current is not PinpointerComponentState state)
return;
SetActive(uid, state.IsActive, pinpointer);
SetDirection(uid, state.DirectionToTarget, pinpointer);
SetDistance(uid, state.DistanceToTarget, pinpointer);
@@ -48,8 +51,8 @@ namespace Content.Client.Pinpointer
if (!Resolve(uid, ref pinpointer, ref appearance))
return;
appearance.SetData(PinpointerVisuals.IsActive, pinpointer.IsActive);
appearance.SetData(PinpointerVisuals.TargetDistance, pinpointer.DistanceToTarget);
_appearance.SetData(uid, PinpointerVisuals.IsActive, pinpointer.IsActive, appearance);
_appearance.SetData(uid, PinpointerVisuals.TargetDistance, pinpointer.DistanceToTarget, appearance);
}
private void UpdateDirAppearance(EntityUid uid, Direction dir,PinpointerComponent? pinpointer = null,
@@ -58,7 +61,7 @@ namespace Content.Client.Pinpointer
if (!Resolve(uid, ref pinpointer, ref appearance))
return;
appearance.SetData(PinpointerVisuals.TargetDirection, dir);
_appearance.SetData(uid, PinpointerVisuals.TargetDirection, dir, appearance);
}
/// <summary>

View File

@@ -38,8 +38,10 @@ namespace Content.Client.Preferences
public void SelectCharacter(int slot)
{
Preferences = new PlayerPreferences(Preferences.Characters, slot, Preferences.AdminOOCColor);
var msg = _netManager.CreateNetMessage<MsgSelectCharacter>();
msg.SelectedCharacterIndex = slot;
var msg = new MsgSelectCharacter
{
SelectedCharacterIndex = slot
};
_netManager.ClientSendMessage(msg);
}
@@ -48,9 +50,11 @@ namespace Content.Client.Preferences
profile.EnsureValid();
var characters = new Dictionary<int, ICharacterProfile>(Preferences.Characters) {[slot] = profile};
Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor);
var msg = _netManager.CreateNetMessage<MsgUpdateCharacter>();
msg.Profile = profile;
msg.Slot = slot;
var msg = new MsgUpdateCharacter
{
Profile = profile,
Slot = slot
};
_netManager.ClientSendMessage(msg);
}
@@ -82,8 +86,10 @@ namespace Content.Client.Preferences
{
var characters = Preferences.Characters.Where(p => p.Key != slot);
Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor);
var msg = _netManager.CreateNetMessage<MsgDeleteCharacter>();
msg.Slot = slot;
var msg = new MsgDeleteCharacter
{
Slot = slot
};
_netManager.ClientSendMessage(msg);
}

View File

@@ -187,7 +187,7 @@ public sealed partial class GunSystem : SharedGunSystem
{
SetCartridgeSpent(cartridge, true);
MuzzleFlash(gun.Owner, cartridge, user);
PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user);
Audio.PlayPredicted(gun.SoundGunshot, gun.Owner, user);
Recoil(user, direction);
// TODO: Can't predict entity deletions.
//if (cartridge.DeleteOnSpawn)
@@ -195,7 +195,7 @@ public sealed partial class GunSystem : SharedGunSystem
}
else
{
PlaySound(gun.Owner, gun.SoundEmpty?.GetSound(Random, ProtoManager), user);
Audio.PlayPredicted(gun.SoundEmpty, gun.Owner, user);
}
if (cartridge.Owner.IsClientSide())
@@ -204,7 +204,7 @@ public sealed partial class GunSystem : SharedGunSystem
break;
case AmmoComponent newAmmo:
MuzzleFlash(gun.Owner, newAmmo, user);
PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user);
Audio.PlayPredicted(gun.SoundGunshot, gun.Owner, user);
Recoil(user, direction);
if (newAmmo.Owner.IsClientSide())
Del(newAmmo.Owner);
@@ -212,7 +212,7 @@ public sealed partial class GunSystem : SharedGunSystem
RemComp<AmmoComponent>(newAmmo.Owner);
break;
case HitscanPrototype:
PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user);
Audio.PlayPredicted(gun.SoundGunshot, gun.Owner, user);
Recoil(user, direction);
break;
}
@@ -225,12 +225,6 @@ public sealed partial class GunSystem : SharedGunSystem
_recoil.KickCamera(user.Value, recoil.Normalized * 0.5f);
}
protected override void PlaySound(EntityUid gun, string? sound, EntityUid? user = null)
{
if (string.IsNullOrEmpty(sound) || user == null || !Timing.IsFirstTimePredicted) return;
SoundSystem.Play(sound, Filter.Local(), gun);
}
protected override void Popup(string message, EntityUid? uid, EntityUid? user)
{
if (uid == null || user == null || !Timing.IsFirstTimePredicted) return;