Fix a bunch of warnings (#11965)
Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -23,6 +23,8 @@ namespace Content.Server.Toilet
|
||||
public sealed class ToiletSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SecretStashSystem _secretStash = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly ToolSystem _toolSystem = default!;
|
||||
@@ -42,7 +44,8 @@ namespace Content.Server.Toilet
|
||||
|
||||
private void OnSuicide(EntityUid uid, ToiletComponent component, SuicideEvent args)
|
||||
{
|
||||
if (args.Handled) return;
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
// Check that victim has a head
|
||||
if (EntityManager.TryGetComponent<SharedBodyComponent>(args.Victim, out var body) &&
|
||||
@@ -180,19 +183,17 @@ namespace Content.Server.Toilet
|
||||
return;
|
||||
|
||||
component.IsSeatUp = !component.IsSeatUp;
|
||||
SoundSystem.Play(component.ToggleSound.GetSound(), Filter.Pvs(uid),
|
||||
uid, AudioHelpers.WithVariation(0.05f));
|
||||
|
||||
_audio.PlayPvs(component.ToggleSound, uid, AudioParams.Default.WithVariation(0.05f));
|
||||
UpdateSprite(uid, component);
|
||||
}
|
||||
|
||||
private void UpdateSprite(EntityUid uid, ToiletComponent component)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(uid,out AppearanceComponent? appearance))
|
||||
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
|
||||
return;
|
||||
|
||||
appearance.SetData(ToiletVisuals.LidOpen, component.LidOpen);
|
||||
appearance.SetData(ToiletVisuals.SeatUp, component.IsSeatUp);
|
||||
_appearance.SetData(uid, ToiletVisuals.LidOpen, component.LidOpen, appearance);
|
||||
_appearance.SetData(uid, ToiletVisuals.SeatUp, component.IsSeatUp, appearance);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@ public sealed class IntrinsicUISystem : EntitySystem
|
||||
|
||||
var attempt = new IntrinsicUIOpenAttemptEvent(uid, key);
|
||||
RaiseLocalEvent(uid, attempt, false);
|
||||
if (attempt.Cancelled) return false;
|
||||
if (attempt.Cancelled)
|
||||
return false;
|
||||
|
||||
ui.Toggle(actor.PlayerSession);
|
||||
return true;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Content.Server.Vehicle
|
||||
/// </summary>
|
||||
private void OnMobStateChanged(EntityUid uid, RiderComponent rider, MobStateChangedEvent args)
|
||||
{
|
||||
if (args.Component.IsCritical() || args.Component.IsDead())
|
||||
if (args.CurrentMobState is DamageState.Critical or DamageState.Dead)
|
||||
{
|
||||
UnbuckleFromVehicle(uid);
|
||||
}
|
||||
|
||||
@@ -131,18 +131,18 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
RaiseLocalEvent(cartridge.Owner, new AmmoShotEvent()
|
||||
{
|
||||
FiredProjectiles = shotProjectiles,
|
||||
}, false);
|
||||
});
|
||||
|
||||
SetCartridgeSpent(cartridge, true);
|
||||
MuzzleFlash(gun.Owner, cartridge, user);
|
||||
PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user);
|
||||
Audio.PlayPredicted(gun.SoundGunshot, gun.Owner, user);
|
||||
|
||||
if (cartridge.DeleteOnSpawn)
|
||||
Del(cartridge.Owner);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySound(gun.Owner, gun.SoundEmpty?.GetSound(Random, ProtoManager), user);
|
||||
Audio.PlayPredicted(gun.SoundEmpty, gun.Owner, user);
|
||||
}
|
||||
|
||||
// Something like ballistic might want to leave it in the container still
|
||||
@@ -155,7 +155,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
case AmmoComponent newAmmo:
|
||||
shotProjectiles.Add(newAmmo.Owner);
|
||||
MuzzleFlash(gun.Owner, newAmmo, user);
|
||||
PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user);
|
||||
Audio.PlayPredicted(gun.SoundGunshot, gun.Owner, user);
|
||||
|
||||
// Do a throw
|
||||
if (!HasComp<ProjectileComponent>(newAmmo.Owner))
|
||||
@@ -214,7 +214,8 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
{
|
||||
FireEffects(fromCoordinates, hitscan.MaxLength, mapDirection.ToAngle(), hitscan);
|
||||
}
|
||||
PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user);
|
||||
|
||||
Audio.PlayPredicted(gun.SoundGunshot, gun.Owner, user);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
@@ -231,7 +232,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
{
|
||||
var physics = EnsureComp<PhysicsComponent>(uid);
|
||||
physics.BodyStatus = BodyStatus.InAir;
|
||||
physics.LinearVelocity = direction.Normalized * speed;
|
||||
Physics.SetLinearVelocity(physics, direction.Normalized * speed);
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
@@ -276,13 +277,6 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
return angle;
|
||||
}
|
||||
|
||||
protected override void PlaySound(EntityUid gun, string? sound, EntityUid? user = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sound)) return;
|
||||
|
||||
SoundSystem.Play(sound, Filter.Pvs(gun, entityManager: EntityManager).RemoveWhereAttachedEntity(e => e == user), gun);
|
||||
}
|
||||
|
||||
protected override void Popup(string message, EntityUid? uid, EntityUid? user) {}
|
||||
|
||||
protected override void CreateEffect(EntityUid uid, MuzzleFlashEvent message, EntityUid? user = null)
|
||||
|
||||
@@ -23,11 +23,13 @@ namespace Content.Server.Wires;
|
||||
public sealed class WiresSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
||||
[Dependency] private readonly ToolSystem _toolSystem = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||
|
||||
private IRobustRandom _random = new RobustRandom();
|
||||
|
||||
@@ -476,12 +478,13 @@ public sealed class WiresSystem : EntitySystem
|
||||
|
||||
if (component.IsPanelOpen)
|
||||
{
|
||||
SoundSystem.Play(component.ScrewdriverOpenSound.GetSound(), Filter.Pvs(args.Target), args.Target);
|
||||
_audio.PlayPvs(component.ScrewdriverOpenSound, args.Target);
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundSystem.Play(component.ScrewdriverCloseSound.GetSound(), Filter.Pvs(args.Target), args.Target);
|
||||
_uiSystem.GetUiOrNull(args.Target, WiresUiKey.Key)?.CloseAll();
|
||||
_audio.PlayPvs(component.ScrewdriverCloseSound, args.Target);
|
||||
var ui = _uiSystem.GetUiOrNull(args.Target, WiresUiKey.Key);
|
||||
_uiSystem.CloseAll(ui);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,7 +551,7 @@ public sealed class WiresSystem : EntitySystem
|
||||
if (!Resolve(uid, ref appearance, ref wires, false))
|
||||
return;
|
||||
|
||||
appearance.SetData(WiresVisuals.MaintenancePanelState, wires.IsPanelOpen && wires.IsPanelVisible);
|
||||
_appearance.SetData(uid, WiresVisuals.MaintenancePanelState, wires.IsPanelOpen && wires.IsPanelVisible, appearance);
|
||||
}
|
||||
|
||||
private void UpdateUserInterface(EntityUid uid, WiresComponent? wires = null, ServerUserInterfaceComponent? ui = null)
|
||||
@@ -578,18 +581,18 @@ public sealed class WiresSystem : EntitySystem
|
||||
|
||||
statuses.Sort((a, b) => a.position.CompareTo(b.position));
|
||||
|
||||
_uiSystem.GetUiOrNull(uid, WiresUiKey.Key)?.SetState(
|
||||
new WiresBoundUserInterfaceState(
|
||||
clientList.ToArray(),
|
||||
statuses.Select(p => new StatusEntry(p.key, p.value)).ToArray(),
|
||||
wires.BoardName,
|
||||
wires.SerialNumber,
|
||||
wires.WireSeed));
|
||||
_uiSystem.TrySetUiState(uid, WiresUiKey.Key, new WiresBoundUserInterfaceState(
|
||||
clientList.ToArray(),
|
||||
statuses.Select(p => new StatusEntry(p.key, p.value)).ToArray(),
|
||||
wires.BoardName,
|
||||
wires.SerialNumber,
|
||||
wires.WireSeed), ui: ui);
|
||||
}
|
||||
|
||||
public void OpenUserInterface(EntityUid uid, IPlayerSession player)
|
||||
{
|
||||
_uiSystem.GetUiOrNull(uid, WiresUiKey.Key)?.Open(player);
|
||||
if (_uiSystem.TryGetUi(uid, WiresUiKey.Key, out var ui))
|
||||
_uiSystem.OpenUi(ui, player);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -800,7 +803,7 @@ public sealed class WiresSystem : EntitySystem
|
||||
wire.Action.Pulse(user, wire);
|
||||
|
||||
UpdateUserInterface(used);
|
||||
SoundSystem.Play(wires.PulseSound.GetSound(), Filter.Pvs(used), used);
|
||||
_audio.PlayPvs(wires.PulseSound, used);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user