diff --git a/.github/workflows/build-test-debug.yml b/.github/workflows/build-test-debug.yml index e60070f149..ebd00d2f3c 100644 --- a/.github/workflows/build-test-debug.yml +++ b/.github/workflows/build-test-debug.yml @@ -16,6 +16,7 @@ jobs: os: [ubuntu-latest] runs-on: ${{ matrix.os }} + timeout-minutes: 30 steps: - name: Checkout Master diff --git a/Content.Client/Access/Systems/JobStatusSystem.cs b/Content.Client/Access/Systems/JobStatusSystem.cs index e651bfdb70..0b4ef98720 100644 --- a/Content.Client/Access/Systems/JobStatusSystem.cs +++ b/Content.Client/Access/Systems/JobStatusSystem.cs @@ -10,7 +10,6 @@ public sealed partial class JobStatusSystem : SharedJobStatusSystem { [Dependency] private ShowJobIconsSystem _showJobIcons = default!; [Dependency] private ShowCrewIconsSystem _showCrewIcons = default!; - [Dependency] private IPrototypeManager _prototype = default!; private static readonly ProtoId CrewBorderIcon = "CrewBorderIcon"; private static readonly ProtoId CrewUncertainBorderIcon = "CrewUncertainBorderIcon"; @@ -26,14 +25,14 @@ public sealed partial class JobStatusSystem : SharedJobStatusSystem private void OnGetStatusIconsEvent(Entity ent, ref GetStatusIconsEvent ev) { if (_showJobIcons.IsActive && ent.Comp.JobStatusIcon != null) - ev.StatusIcons.Add(_prototype.Index(ent.Comp.JobStatusIcon)); + ev.StatusIcons.Add(ProtoMan.Index(ent.Comp.JobStatusIcon)); if (_showCrewIcons.IsActive) { if (_showCrewIcons.UncertainCrewBorder) - ev.StatusIcons.Add(_prototype.Index(CrewUncertainBorderIcon)); + ev.StatusIcons.Add(ProtoMan.Index(CrewUncertainBorderIcon)); else if (ent.Comp.IsCrew) - ev.StatusIcons.Add(_prototype.Index(CrewBorderIcon)); + ev.StatusIcons.Add(ProtoMan.Index(CrewBorderIcon)); } } } diff --git a/Content.Client/Actions/ActionsSystem.cs b/Content.Client/Actions/ActionsSystem.cs index 90cf4190f2..aac14a1420 100644 --- a/Content.Client/Actions/ActionsSystem.cs +++ b/Content.Client/Actions/ActionsSystem.cs @@ -17,7 +17,6 @@ using Robust.Shared.Serialization.Markdown; using Robust.Shared.Serialization.Markdown.Mapping; using Robust.Shared.Serialization.Markdown.Sequence; using Robust.Shared.Serialization.Markdown.Value; -using Robust.Shared.Timing; using Robust.Shared.Utility; using YamlDotNet.RepresentationModel; @@ -30,7 +29,6 @@ namespace Content.Client.Actions [Dependency] private SharedChargesSystem _sharedCharges = default!; [Dependency] private IPlayerManager _playerManager = default!; - [Dependency] private IPrototypeManager _proto = default!; [Dependency] private IResourceManager _resources = default!; [Dependency] private MetaDataSystem _metaData = default!; [Dependency] private ISerializationManager _serialization = default!; @@ -257,7 +255,7 @@ namespace Content.Client.Actions else if (map.TryGet("entity", out var entityNode)) { var id = new EntProtoId(entityNode.Value); - var proto = _proto.Index(id); + var proto = ProtoMan.Index(id); actionId = Spawn(MappingEntityAction); SetIcon(actionId, new SpriteSpecifier.EntityPrototype(id)); SetEvent(actionId, new StartPlacementActionEvent() @@ -270,7 +268,7 @@ namespace Content.Client.Actions else if (map.TryGet("tileId", out var tileNode)) { var id = new ProtoId(tileNode.Value); - var proto = _proto.Index(id); + var proto = ProtoMan.Index(id); actionId = Spawn(MappingEntityAction); if (proto.Sprite is {} sprite) SetIcon(actionId, new SpriteSpecifier.Texture(sprite)); diff --git a/Content.Client/Administration/AdminQuickInfoSystem.cs b/Content.Client/Administration/AdminQuickInfoSystem.cs index dec319136c..55e1979a99 100644 --- a/Content.Client/Administration/AdminQuickInfoSystem.cs +++ b/Content.Client/Administration/AdminQuickInfoSystem.cs @@ -39,7 +39,6 @@ internal sealed partial class AdminQuickInfoCommand : LocalizedEntityCommands internal sealed partial class AdminQuickInfoSystem : EntitySystem { [Dependency] private AdminSystem _adminSystem = null!; - [Dependency] private IPrototypeManager _prototypeManager = null!; public event Action? EntityResponseReceived; @@ -152,7 +151,7 @@ internal sealed partial class AdminQuickInfoSystem : EntitySystem sb.AppendMarkupLine(Loc.GetString("admin-quick-info-job", ("job", _playerInfo.StartingJob))); - if (_playerInfo.RoleProto is { } roleId && _system._prototypeManager.Resolve(roleId, out var role)) + if (_playerInfo.RoleProto is { } roleId && _system.ProtoMan.Resolve(roleId, out var role)) { var roleColor = role.Color.ToHex(); var symbol = _playerInfo.Antag ? role.Symbol : ""; diff --git a/Content.Client/Administration/Systems/AdminSystem.Overlay.cs b/Content.Client/Administration/Systems/AdminSystem.Overlay.cs index a07abae90c..3fb85b59d3 100644 --- a/Content.Client/Administration/Systems/AdminSystem.Overlay.cs +++ b/Content.Client/Administration/Systems/AdminSystem.Overlay.cs @@ -4,7 +4,6 @@ using Robust.Client.Graphics; using Robust.Client.ResourceManagement; using Robust.Client.UserInterface; using Robust.Shared.Configuration; -using Robust.Shared.Prototypes; namespace Content.Client.Administration.Systems { @@ -18,7 +17,6 @@ namespace Content.Client.Administration.Systems [Dependency] private IUserInterfaceManager _userInterfaceManager = default!; [Dependency] private IConfigurationManager _configurationManager = default!; [Dependency] private SharedRoleSystem _roles = default!; - [Dependency] private IPrototypeManager _proto = default!; private AdminNameOverlay _adminNameOverlay = default!; @@ -36,7 +34,7 @@ namespace Content.Client.Administration.Systems _userInterfaceManager, _configurationManager, _roles, - _proto); + ProtoMan); _adminManager.AdminStatusUpdated += OnAdminStatusUpdated; } diff --git a/Content.Client/Administration/UI/Tabs/ServerTab.xaml b/Content.Client/Administration/UI/Tabs/ServerTab.xaml index 7898df6c1b..f3a6421aea 100644 --- a/Content.Client/Administration/UI/Tabs/ServerTab.xaml +++ b/Content.Client/Administration/UI/Tabs/ServerTab.xaml @@ -9,6 +9,7 @@ + diff --git a/Content.Client/Administration/UI/Tabs/ServerTab.xaml.cs b/Content.Client/Administration/UI/Tabs/ServerTab.xaml.cs index 1c83ff2847..e8ba41a3fe 100644 --- a/Content.Client/Administration/UI/Tabs/ServerTab.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/ServerTab.xaml.cs @@ -1,4 +1,4 @@ -using System.Globalization; +using System.Globalization; using Content.Shared.CCVar; using Robust.Client.AutoGenerated; using Robust.Client.Console; @@ -21,6 +21,7 @@ namespace Content.Client.Administration.UI.Tabs _config.OnValueChanged(CCVars.OocEnabled, OocEnabledChanged, true); _config.OnValueChanged(CCVars.LoocEnabled, LoocEnabledChanged, true); + _config.OnValueChanged(CCVars.DeadChatEnabled, DeadChatEnabledChanged, true); _config.OnValueChanged(CCVars.AfkTime, AfkTimeChanged, true); _config.OnValueChanged(CCVars.AdminAfkTime, AdminAfkTimeChanged, true); _config.OnValueChanged(CCVars.AfkConfirmTimeout, AfkConfirmTimeoutChanged, true); @@ -57,6 +58,11 @@ namespace Content.Client.Administration.UI.Tabs SetLoocButton.Pressed = value; } + private void DeadChatEnabledChanged(bool value) + { + SetDeadChatButton.Pressed = value; + } + private void AfkTimeChanged(float value) { AfkTime.PlaceHolder = value.ToString(CultureInfo.InvariantCulture); diff --git a/Content.Client/Alerts/ClientAlertsSystem.cs b/Content.Client/Alerts/ClientAlertsSystem.cs index 29cd5da190..a42380180e 100644 --- a/Content.Client/Alerts/ClientAlertsSystem.cs +++ b/Content.Client/Alerts/ClientAlertsSystem.cs @@ -15,7 +15,6 @@ public sealed partial class ClientAlertsSystem : AlertsSystem public AlertOrderPrototype? AlertOrder { get; set; } [Dependency] private IPlayerManager _playerManager = default!; - [Dependency] private IPrototypeManager _prototypeManager = default!; [Dependency] private IUserInterfaceManager _ui = default!; public event EventHandler? ClearAlerts; @@ -39,7 +38,7 @@ public sealed partial class ClientAlertsSystem : AlertsSystem { base.LoadPrototypes(); - AlertOrder = _prototypeManager.EnumeratePrototypes().FirstOrDefault(); + AlertOrder = ProtoMan.EnumeratePrototypes().FirstOrDefault(); if (AlertOrder == null) Log.Error("No alertOrder prototype found, alerts will be in random order"); } diff --git a/Content.Client/Atmos/AlignAtmosPipeLayers.cs b/Content.Client/Atmos/AlignAtmosPipeLayers.cs index c8e69bc17f..5df861e9d8 100644 --- a/Content.Client/Atmos/AlignAtmosPipeLayers.cs +++ b/Content.Client/Atmos/AlignAtmosPipeLayers.cs @@ -6,7 +6,6 @@ using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.Placement; using Robust.Client.Placement.Modes; -using Robust.Client.Utility; using Robust.Shared.Enums; using Robust.Shared.Map; using Robust.Shared.Map.Components; @@ -27,7 +26,6 @@ public sealed partial class AlignAtmosPipeLayers : SnapgridCenter { [Dependency] private IEntityManager _entityManager = default!; [Dependency] private IPrototypeManager _protoManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IEyeManager _eyeManager = default!; private readonly SharedMapSystem _mapSystem; @@ -87,7 +85,7 @@ public sealed partial class AlignAtmosPipeLayers : SnapgridCenter if (pManager.PlacementType != PlacementTypes.None) return; - MouseCoords = _unalignedMouseCoords.AlignWithClosestGridTile(SearchBoxSize, _entityManager, _mapManager); + MouseCoords = _unalignedMouseCoords.AlignWithClosestGridTile(SearchBoxSize, _entityManager); var gridId = _transformSystem.GetGrid(MouseCoords); @@ -169,7 +167,7 @@ public sealed partial class AlignAtmosPipeLayers : SnapgridCenter if (!_protoManager.TryIndex(pManager.CurrentPermission.EntityType, out var currentProto)) return; - if (!currentProto.TryGetComponent(out var atmosPipeLayers, _entityManager.ComponentFactory)) + if (!currentProto.TryComp(out var atmosPipeLayers, _entityManager.ComponentFactory)) return; if (!_pipeLayersSystem.TryGetAlternativePrototype(atmosPipeLayers, layer, out var newProtoId)) @@ -181,7 +179,7 @@ public sealed partial class AlignAtmosPipeLayers : SnapgridCenter pManager.CurrentPermission.EntityType = newProtoId; // Update the appearance of the ghost sprite - if (newProto.TryGetComponent(out var sprite, _entityManager.ComponentFactory)) + if (newProto.TryComp(out var sprite, _entityManager.ComponentFactory)) { var textures = new List(); diff --git a/Content.Client/Atmos/EntitySystems/GasCanisterAppearanceSystem.cs b/Content.Client/Atmos/EntitySystems/GasCanisterAppearanceSystem.cs index d54f4d20a6..1d0bf5d315 100644 --- a/Content.Client/Atmos/EntitySystems/GasCanisterAppearanceSystem.cs +++ b/Content.Client/Atmos/EntitySystems/GasCanisterAppearanceSystem.cs @@ -1,7 +1,6 @@ using Content.Shared.Atmos.Piping.Unary.Components; using Content.Shared.SprayPainter.Prototypes; using Robust.Client.GameObjects; -using Robust.Shared.Prototypes; namespace Content.Client.Atmos.EntitySystems; @@ -10,14 +9,12 @@ namespace Content.Client.Atmos.EntitySystems; /// public sealed partial class GasCanisterAppearanceSystem : VisualizerSystem { - [Dependency] private IPrototypeManager _prototypeManager = default!; - protected override void OnAppearanceChange(EntityUid uid, GasCanisterComponent component, ref AppearanceChangeEvent args) { if (!AppearanceSystem.TryGetData(uid, PaintableVisuals.Prototype, out var protoName, args.Component) || args.Sprite is not { } old) return; - if (!_prototypeManager.HasIndex(protoName)) + if (!ProtoMan.HasIndex(protoName)) return; // Create the given prototype and get its first layer. diff --git a/Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs b/Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs index 33fec9d985..448261e33c 100644 --- a/Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs +++ b/Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs @@ -21,7 +21,6 @@ namespace Content.Client.Atmos.Overlays; public sealed partial class AtmosDebugOverlay : Overlay { [Dependency] private IEntityManager _entManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IInputManager _input = default!; [Dependency] private IUserInterfaceManager _ui = default!; [Dependency] private IResourceCache _cache = default!; @@ -262,7 +261,7 @@ public sealed partial class AtmosDebugOverlay : Overlay private void GetGrids(MapId mapId, Box2Rotated box) { _grids.Clear(); - _mapManager.FindGridsIntersecting( + _map.FindGridsIntersecting( mapId, box, ref _grids, diff --git a/Content.Client/Atmos/Overlays/GasTileDangerousTemperatureOverlay.cs b/Content.Client/Atmos/Overlays/GasTileDangerousTemperatureOverlay.cs index 65d1b11e53..bdd62db9a8 100644 --- a/Content.Client/Atmos/Overlays/GasTileDangerousTemperatureOverlay.cs +++ b/Content.Client/Atmos/Overlays/GasTileDangerousTemperatureOverlay.cs @@ -19,10 +19,10 @@ public sealed partial class GasTileDangerousTemperatureOverlay : Overlay public override bool RequestScreenTexture { get; set; } = false; [Dependency] private IEntityManager _entManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IClyde _clyde = default!; private GasTileOverlaySystem? _gasTileOverlay; + private readonly SharedMapSystem _mapSys; private readonly SharedTransformSystem _xformSys; private EntityQuery _overlayQuery; @@ -37,6 +37,7 @@ public sealed partial class GasTileDangerousTemperatureOverlay : Overlay public GasTileDangerousTemperatureOverlay() { IoCManager.InjectDependencies(this); + _mapSys = _entManager.System(); _xformSys = _entManager.System(); _overlayQuery = _entManager.GetEntityQuery(); @@ -174,7 +175,7 @@ public sealed partial class GasTileDangerousTemperatureOverlay : Overlay () => { _grids.Clear(); - _mapManager.FindGridsIntersecting(mapId, worldAABB, ref _grids); + _mapSys.FindGridsIntersecting(mapId, worldAABB, ref _grids); foreach (var grid in _grids) { diff --git a/Content.Client/Atmos/Overlays/GasTileFireOverlay.cs b/Content.Client/Atmos/Overlays/GasTileFireOverlay.cs index 45cebef98b..370ed2a792 100644 --- a/Content.Client/Atmos/Overlays/GasTileFireOverlay.cs +++ b/Content.Client/Atmos/Overlays/GasTileFireOverlay.cs @@ -23,7 +23,6 @@ public sealed partial class GasTileFireOverlay : Overlay [Dependency] private IPrototypeManager _protoMan = default!; [Dependency] private IResourceCache _resourceCache = default!; [Dependency] private IEntityManager _entManager = default!; - [Dependency] private IMapManager _mapManager = default!; public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities | OverlaySpace.WorldSpaceBelowWorld; private static readonly ProtoId UnshadedShader = "unshaded"; @@ -113,7 +112,7 @@ public sealed partial class GasTileFireOverlay : Overlay return; // TODO: WorldBounds callback. - _mapManager.FindGridsIntersecting(args.MapId, args.WorldAABB, ref gridState, + _mapSystem.FindGridsIntersecting(args.MapId, args.WorldAABB, ref gridState, static (EntityUid uid, MapGridComponent grid, ref (Box2Rotated WorldBounds, DrawingHandleWorld drawHandle, diff --git a/Content.Client/Atmos/Overlays/GasTileHeatBlurOverlay.cs b/Content.Client/Atmos/Overlays/GasTileHeatBlurOverlay.cs index 7815bec6e4..4dc1300193 100644 --- a/Content.Client/Atmos/Overlays/GasTileHeatBlurOverlay.cs +++ b/Content.Client/Atmos/Overlays/GasTileHeatBlurOverlay.cs @@ -28,12 +28,12 @@ public sealed partial class GasTileHeatBlurOverlay : Overlay private static readonly ProtoId HeatOverlayShader = "HeatBlur"; [Dependency] private IEntityManager _entManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IPrototypeManager _proto = default!; [Dependency] private IClyde _clyde = default!; [Dependency] private IConfigurationManager _configManager = default!; [Dependency] private IResourceCache _resourceCache = default!; + private readonly SharedMapSystem _maps; private readonly SharedTransformSystem _xformSys; private readonly ShaderInstance _shader; @@ -63,6 +63,7 @@ public sealed partial class GasTileHeatBlurOverlay : Overlay public GasTileHeatBlurOverlay() { IoCManager.InjectDependencies(this); + _maps = _entManager.System(); _xformSys = _entManager.System(); _noiseTexture = _resourceCache.GetTexture("/Textures/Effects/HeatBlur/perlin_noise.png"); @@ -126,7 +127,7 @@ public sealed partial class GasTileHeatBlurOverlay : Overlay () => { _intersectingGrids.Clear(); - _mapManager.FindGridsIntersecting(mapId, worldAABB, ref _intersectingGrids); + _maps.FindGridsIntersecting(mapId, worldAABB, ref _intersectingGrids); foreach (var grid in _intersectingGrids) { if (!overlayQuery.TryGetComponent(grid.Owner, out var comp)) diff --git a/Content.Client/Atmos/Overlays/GasTileVisibleGasOverlay.cs b/Content.Client/Atmos/Overlays/GasTileVisibleGasOverlay.cs index d5b21aeabe..65d0b919d0 100644 --- a/Content.Client/Atmos/Overlays/GasTileVisibleGasOverlay.cs +++ b/Content.Client/Atmos/Overlays/GasTileVisibleGasOverlay.cs @@ -25,7 +25,6 @@ public sealed partial class GasTileVisibleGasOverlay : Overlay [Dependency] private IEntityManager _entManager = default!; [Dependency] private IResourceCache _resourceCache = default!; [Dependency] private IPrototypeManager _protoManager = default!; - [Dependency] private IMapManager _mapManager = default!; private static readonly ProtoId UnshadedShader = "unshaded"; @@ -142,7 +141,7 @@ public sealed partial class GasTileVisibleGasOverlay : Overlay return; // TODO: WorldBounds callback. - _mapManager.FindGridsIntersecting(args.MapId, + _mapSystem.FindGridsIntersecting(args.MapId, args.WorldAABB, ref gridState, static (EntityUid uid, diff --git a/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs b/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs index f22f2fd31b..b98ad5ad74 100644 --- a/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs +++ b/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs @@ -24,7 +24,6 @@ public sealed partial class ContentAudioSystem [Dependency] private IGameTiming _timing = default!; [Dependency] private ILogManager _logManager = default!; [Dependency] private IPlayerManager _player = default!; - [Dependency] private IPrototypeManager _proto = default!; [Dependency] private IRobustRandom _random = default!; [Dependency] private IStateManager _state = default!; [Dependency] private RulesSystem _rules = default!; @@ -106,7 +105,7 @@ public sealed partial class ContentAudioSystem private void SetupAmbientSounds() { _ambientSounds.Clear(); - foreach (var ambience in _proto.EnumeratePrototypes()) + foreach (var ambience in ProtoMan.EnumeratePrototypes()) { var tracks = _ambientSounds.GetOrNew(ambience.ID); RefreshTracks(ambience.Sound, tracks, null); @@ -131,7 +130,7 @@ public sealed partial class ContentAudioSystem if (collection.Collection == null) break; - var slothCud = _proto.Index(collection.Collection); + var slothCud = ProtoMan.Index(collection.Collection); tracks.AddRange(slothCud.PickFiles); break; case SoundPathSpecifier path: @@ -167,7 +166,7 @@ public sealed partial class ContentAudioSystem { var player = _player.LocalSession?.AttachedEntity; - if (player == null || _musicProto == null || !_rules.IsTrue(player.Value, _proto.Index(_musicProto.Rules))) + if (player == null || _musicProto == null || !_rules.IsTrue(player.Value, ProtoMan.Index(_musicProto.Rules))) { FadeOut(_ambientMusicStream, duration: AmbientMusicFadeTime); _musicProto = null; @@ -241,12 +240,12 @@ public sealed partial class ContentAudioSystem if (ev.Cancelled) return null; - var ambiences = _proto.EnumeratePrototypes().ToList(); + var ambiences = ProtoMan.EnumeratePrototypes().ToList(); ambiences.Sort((x, y) => y.Priority.CompareTo(x.Priority)); foreach (var amb in ambiences) { - if (!_rules.IsTrue(player.Value, _proto.Index(amb.Rules))) + if (!_rules.IsTrue(player.Value, ProtoMan.Index(amb.Rules))) continue; return amb; diff --git a/Content.Client/Audio/Jukebox/JukeboxSystem.cs b/Content.Client/Audio/Jukebox/JukeboxSystem.cs index 0194c1ccbd..2caac59f64 100644 --- a/Content.Client/Audio/Jukebox/JukeboxSystem.cs +++ b/Content.Client/Audio/Jukebox/JukeboxSystem.cs @@ -8,7 +8,6 @@ namespace Content.Client.Audio.Jukebox; public sealed partial class JukeboxSystem : SharedJukeboxSystem { - [Dependency] private IPrototypeManager _protoManager = default!; [Dependency] private AnimationPlayerSystem _animationPlayer = default!; [Dependency] private SharedAppearanceSystem _appearanceSystem = default!; [Dependency] private SharedUserInterfaceSystem _uiSystem = default!; @@ -21,13 +20,13 @@ public sealed partial class JukeboxSystem : SharedJukeboxSystem SubscribeLocalEvent(OnAnimationCompleted); SubscribeLocalEvent(OnJukeboxAfterState); - _protoManager.PrototypesReloaded += OnProtoReload; + ProtoMan.PrototypesReloaded += OnProtoReload; } public override void Shutdown() { base.Shutdown(); - _protoManager.PrototypesReloaded -= OnProtoReload; + ProtoMan.PrototypesReloaded -= OnProtoReload; } private void OnProtoReload(PrototypesReloadedEventArgs obj) diff --git a/Content.Client/BarSign/BarSignVisualizerSystem.cs b/Content.Client/BarSign/BarSignVisualizerSystem.cs index e17d264cb5..029c4724dc 100644 --- a/Content.Client/BarSign/BarSignVisualizerSystem.cs +++ b/Content.Client/BarSign/BarSignVisualizerSystem.cs @@ -1,14 +1,11 @@ using Content.Shared.BarSign; using Content.Shared.Power; using Robust.Client.GameObjects; -using Robust.Shared.Prototypes; namespace Content.Client.BarSign; public sealed partial class BarSignVisualizerSystem : VisualizerSystem { - [Dependency] private IPrototypeManager _prototypeManager = default!; - protected override void OnAppearanceChange(EntityUid uid, BarSignComponent component, ref AppearanceChangeEvent args) { AppearanceSystem.TryGetData(uid, PowerDeviceVisuals.Powered, out var powered, args.Component); @@ -16,7 +13,7 @@ public sealed partial class BarSignVisualizerSystem : VisualizerSystem(currentSign, out var proto)) + && ProtoMan.Resolve(currentSign, out var proto)) { SpriteSystem.LayerSetSprite((uid, args.Sprite), 0, proto.Icon); args.Sprite?.LayerSetShader(0, "unshaded"); diff --git a/Content.Client/Body/VisualBodySystem.cs b/Content.Client/Body/VisualBodySystem.cs index c7b5825d14..c29a60cc97 100644 --- a/Content.Client/Body/VisualBodySystem.cs +++ b/Content.Client/Body/VisualBodySystem.cs @@ -7,7 +7,6 @@ using Content.Shared.Humanoid; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Shared.Configuration; -using Robust.Shared.Prototypes; using Robust.Shared.Utility; namespace Content.Client.Body; @@ -15,7 +14,6 @@ namespace Content.Client.Body; public sealed partial class VisualBodySystem : SharedVisualBodySystem { [Dependency] private IConfigurationManager _cfg = default!; - [Dependency] private IPrototypeManager _prototype = default!; [Dependency] private DisplacementMapSystem _displacement = default!; [Dependency] private MarkingManager _marking = default!; [Dependency] private SpriteSystem _sprite = default!; @@ -149,7 +147,7 @@ public sealed partial class VisualBodySystem : SharedVisualBodySystem if (!censorNudity) yield break; - var group = _prototype.Index(ent.Comp.MarkingData.Group); + var group = ProtoMan.Index(ent.Comp.MarkingData.Group); foreach (var layer in ent.Comp.MarkingData.Layers) { if (!group.Limits.TryGetValue(layer, out var layerLimits)) diff --git a/Content.Client/Chat/TypingIndicator/TypingIndicatorVisualizerSystem.cs b/Content.Client/Chat/TypingIndicator/TypingIndicatorVisualizerSystem.cs index 1c43b84692..8fb0a750bb 100644 --- a/Content.Client/Chat/TypingIndicator/TypingIndicatorVisualizerSystem.cs +++ b/Content.Client/Chat/TypingIndicator/TypingIndicatorVisualizerSystem.cs @@ -1,13 +1,11 @@ using Content.Shared.Chat.TypingIndicator; using Robust.Client.GameObjects; -using Robust.Shared.Prototypes; using Content.Shared.Inventory; namespace Content.Client.Chat.TypingIndicator; public sealed partial class TypingIndicatorVisualizerSystem : VisualizerSystem { - [Dependency] private IPrototypeManager _prototypeManager = default!; [Dependency] private InventorySystem _inventory = default!; protected override void OnAppearanceChange(EntityUid uid, TypingIndicatorComponent component, ref AppearanceChangeEvent args) @@ -27,7 +25,7 @@ public sealed partial class TypingIndicatorVisualizerSystem : VisualizerSystem()) + foreach (var reagent in ProtoMan.EnumeratePrototypes()) { _reagentSources.Add(reagent.ID, new()); } - foreach (var reaction in PrototypeManager.EnumeratePrototypes()) + foreach (var reaction in ProtoMan.EnumeratePrototypes()) { if (!reaction.Source) continue; @@ -72,7 +70,7 @@ public sealed partial class ChemistryGuideDataSystem : SharedChemistryGuideDataS } } - foreach (var gas in PrototypeManager.EnumeratePrototypes()) + foreach (var gas in ProtoMan.EnumeratePrototypes()) { if (gas.Reagent == null) continue; @@ -85,20 +83,20 @@ public sealed partial class ChemistryGuideDataSystem : SharedChemistryGuideDataS // store the names of the entities used so we don't get repeats in the guide. var usedNames = new List(); - foreach (var entProto in PrototypeManager.EnumeratePrototypes()) + foreach (var entProto in ProtoMan.EnumeratePrototypes()) { if (entProto.Abstract || usedNames.Contains(entProto.Name)) continue; - if (!entProto.TryGetComponent(out var extractableComponent, EntityManager.ComponentFactory)) + if (!entProto.TryComp(out ExtractableComponent? extractableComponent, Factory)) continue; //these bloat the hell out of blood/fat - if (entProto.HasComponent()) + if (entProto.HasComp(Factory)) continue; //these feel obvious... - if (entProto.HasComponent()) + if (entProto.HasComp(Factory)) continue; if (extractableComponent.JuiceSolution is { } juiceSolution) diff --git a/Content.Client/Chemistry/EntitySystems/InjectorStatusControlSystem.cs b/Content.Client/Chemistry/EntitySystems/InjectorStatusControlSystem.cs index 87983661f2..6a7bf0ac41 100644 --- a/Content.Client/Chemistry/EntitySystems/InjectorStatusControlSystem.cs +++ b/Content.Client/Chemistry/EntitySystems/InjectorStatusControlSystem.cs @@ -2,19 +2,16 @@ using Content.Client.Items; using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.EntitySystems; -using Robust.Shared.Prototypes; namespace Content.Client.Chemistry.EntitySystems; public sealed partial class InjectorStatusControlSystem : EntitySystem { [Dependency] private SharedSolutionContainerSystem _solutionContainers = default!; - [Dependency] private IPrototypeManager _prototypeManager = default!; - public override void Initialize() { base.Initialize(); - Subs.ItemStatus(injector => new InjectorStatusControl(injector, _solutionContainers, _prototypeManager)); + Subs.ItemStatus(injector => new InjectorStatusControl(injector, _solutionContainers, ProtoMan)); } } diff --git a/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs b/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs index 0891dd8710..7d2874bd11 100644 --- a/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs +++ b/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs @@ -8,13 +8,11 @@ using Content.Shared.Hands; using Content.Shared.Item; using Content.Shared.Rounding; using Robust.Client.GameObjects; -using Robust.Shared.Prototypes; namespace Content.Client.Chemistry.Visualizers; public sealed partial class SolutionContainerVisualsSystem : VisualizerSystem { - [Dependency] private IPrototypeManager _prototype = default!; [Dependency] private ItemSystem _itemSystem = default!; public override void Initialize() @@ -131,7 +129,7 @@ public sealed partial class SolutionContainerVisualsSystem : VisualizerSystem(baseOverride); + var reagentProto = ProtoMan.Index(baseOverride); if (SpriteSystem.LayerMapTryGet(ent, component.OverlayLayer, out var overlayLayer, false)) SpriteSystem.LayerSetVisible(ent, overlayLayer, reagentProto.MetamorphicSprite is not null); diff --git a/Content.Client/Clothing/Systems/ChameleonClothingSystem.cs b/Content.Client/Clothing/Systems/ChameleonClothingSystem.cs index 08153c3b3f..deffb0de3d 100644 --- a/Content.Client/Clothing/Systems/ChameleonClothingSystem.cs +++ b/Content.Client/Clothing/Systems/ChameleonClothingSystem.cs @@ -1,8 +1,6 @@ -using System.Linq; -using Content.Client.PDA; +using Content.Client.PDA; using Content.Shared.Clothing.Components; using Content.Shared.Clothing.EntitySystems; -using Content.Shared.Inventory; using Robust.Client.GameObjects; using Robust.Shared.Prototypes; @@ -35,14 +33,14 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem { base.UpdateSprite(uid, proto); if (TryComp(uid, out SpriteComponent? sprite) - && proto.TryGetComponent(out SpriteComponent? otherSprite, Factory)) + && proto.TryComp(out SpriteComponent? otherSprite, Factory)) { sprite.CopyFrom(otherSprite); } // Edgecase for PDAs to include visuals when UI is open if (TryComp(uid, out PdaBorderColorComponent? borderColor) - && proto.TryGetComponent(out PdaBorderColorComponent? otherBorderColor, Factory)) + && proto.TryComp(out PdaBorderColorComponent? otherBorderColor, Factory)) { borderColor.BorderColor = otherBorderColor.BorderColor; borderColor.AccentHColor = otherBorderColor.AccentHColor; diff --git a/Content.Client/Clothing/UI/ChameleonBoundUserInterface.cs b/Content.Client/Clothing/UI/ChameleonBoundUserInterface.cs index c46c84f42d..9fe36d683c 100644 --- a/Content.Client/Clothing/UI/ChameleonBoundUserInterface.cs +++ b/Content.Client/Clothing/UI/ChameleonBoundUserInterface.cs @@ -48,7 +48,7 @@ public sealed partial class ChameleonBoundUserInterface : BoundUserInterface if (string.IsNullOrEmpty(target) || !_proto.Resolve(target, out EntityPrototype? proto)) continue; - if (!proto.TryGetComponent(out TagComponent? tag, EntMan.ComponentFactory) || !_tag.HasTag(tag, st.RequiredTag)) + if (!proto.TryComp(out TagComponent? tag, EntMan.ComponentFactory) || !_tag.HasTag(tag, st.RequiredTag)) continue; newTargets.Add(target); diff --git a/Content.Client/Construction/ConstructionSystem.cs b/Content.Client/Construction/ConstructionSystem.cs index e38b13a7dd..08fa809a2b 100644 --- a/Content.Client/Construction/ConstructionSystem.cs +++ b/Content.Client/Construction/ConstructionSystem.cs @@ -14,7 +14,6 @@ using Robust.Shared.Input.Binding; using Robust.Shared.Map; using Robust.Shared.Player; using Robust.Shared.Prototypes; -using Robust.Shared.Utility; namespace Content.Client.Construction { @@ -87,9 +86,9 @@ namespace Content.Client.Construction { _recipesMetadataCache.Clear(); - foreach (var constructionProto in PrototypeManager.EnumeratePrototypes()) + foreach (var constructionProto in ProtoMan.EnumeratePrototypes()) { - if (!PrototypeManager.Resolve(constructionProto.Graph, out var graphProto)) + if (!ProtoMan.Resolve(constructionProto.Graph, out var graphProto)) continue; if (constructionProto.TargetNode is not { } targetNodeId) @@ -130,7 +129,7 @@ namespace Content.Client.Construction // If we got the id of the prototype, we exit the “recursion” by clearing the stack. stack.Clear(); - if (!PrototypeManager.Resolve(entityId, out var proto)) + if (!ProtoMan.Resolve(entityId, out var proto)) continue; var name = constructionProto.SetName.HasValue ? Loc.GetString(constructionProto.SetName) : proto.Name; @@ -178,7 +177,7 @@ namespace Content.Client.Construction "construction-ghost-examine-message", ("name", component.Prototype.Name))); - if (!PrototypeManager.Resolve(component.Prototype.Graph, out var graph)) + if (!ProtoMan.Resolve(component.Prototype.Graph, out var graph)) return; var startNode = graph.Nodes[component.Prototype.StartNode]; @@ -279,7 +278,7 @@ namespace Content.Client.Construction return false; } - if (!TryGetRecipePrototype(prototype.ID, out var targetProtoId) || !PrototypeManager.TryIndex(targetProtoId, out EntityPrototype? targetProto)) + if (!TryGetRecipePrototype(prototype.ID, out var targetProtoId) || !ProtoMan.TryIndex(targetProtoId, out EntityPrototype? targetProto)) return false; if (GhostPresent(loc)) @@ -301,7 +300,7 @@ namespace Content.Client.Construction var sprite = Comp(ghost.Value); - if (targetProto.TryGetComponent(out IconComponent? icon, EntityManager.ComponentFactory)) + if (targetProto.TryComp(out IconComponent? icon, EntityManager.ComponentFactory)) { _sprite.AddBlankLayer((ghost.Value, sprite), 0); _sprite.LayerSetSprite((ghost.Value, sprite), 0, icon.Icon); @@ -313,9 +312,9 @@ namespace Content.Client.Construction var dummy = EntityManager.SpawnEntity(targetProtoId, MapCoordinates.Nullspace); var targetSprite = EnsureComp(dummy); EntityManager.System().OnChangeData(dummy, targetSprite); - + var ghostDrawDepth = sprite.DrawDepth; _sprite.CopySprite((dummy, targetSprite), (ghost.Value, sprite)); - + _sprite.SetDrawDepth((ghost.Value, sprite), ghostDrawDepth); for (var i = 0; i < sprite.AllLayers.Count(); i++) { sprite.LayerSetShader(i, "unshaded"); diff --git a/Content.Client/Construction/FlatpackSystem.cs b/Content.Client/Construction/FlatpackSystem.cs index 4aea528298..5cce2e22f6 100644 --- a/Content.Client/Construction/FlatpackSystem.cs +++ b/Content.Client/Construction/FlatpackSystem.cs @@ -25,10 +25,10 @@ public sealed partial class FlatpackSystem : SharedFlatpackSystem if (!_appearance.TryGetData(ent, FlatpackVisuals.Machine, out var machineBoardId) || args.Sprite == null) return; - if (!PrototypeManager.TryIndex(machineBoardId, out var machineBoardPrototype)) + if (!ProtoMan.TryIndex(machineBoardId, out var machineBoardPrototype)) return; - if (!machineBoardPrototype.TryGetComponent(out var sprite, EntityManager.ComponentFactory)) + if (!machineBoardPrototype.TryComp(out SpriteComponent? sprite, EntityManager.ComponentFactory)) return; Color? color = null; diff --git a/Content.Client/Content.Client.csproj b/Content.Client/Content.Client.csproj index b93b5f525a..bad8fb9f91 100644 --- a/Content.Client/Content.Client.csproj +++ b/Content.Client/Content.Client.csproj @@ -25,4 +25,5 @@ + diff --git a/Content.Client/ContextMenu/UI/ContextMenuElement.xaml.cs b/Content.Client/ContextMenu/UI/ContextMenuElement.xaml.cs index 91d34b037b..662759ce14 100644 --- a/Content.Client/ContextMenu/UI/ContextMenuElement.xaml.cs +++ b/Content.Client/ContextMenu/UI/ContextMenuElement.xaml.cs @@ -55,10 +55,10 @@ namespace Content.Client.ContextMenu.UI Text = text; } - protected override void Dispose(bool disposing) + protected override void ExitedTree() { - base.Dispose(disposing); - _subMenu?.Dispose(); + base.ExitedTree(); + _subMenu?.Orphan(); _subMenu = null; ParentMenu = null; } diff --git a/Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs b/Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs index dd5642ae45..0e2fd8a070 100644 --- a/Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs +++ b/Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs @@ -70,11 +70,11 @@ namespace Content.Client.ContextMenu.UI }; } - protected override void Dispose(bool disposing) + protected override void ExitedTree() { + base.ExitedTree(); MenuBody.OnChildRemoved -= ctrl => _uiController.OnRemoveElement(this, ctrl); ParentElement = null; - base.Dispose(disposing); } } } diff --git a/Content.Client/ContextMenu/UI/ContextMenuUIController.cs b/Content.Client/ContextMenu/UI/ContextMenuUIController.cs index ca173ff1e1..37a1e71179 100644 --- a/Content.Client/ContextMenu/UI/ContextMenuUIController.cs +++ b/Content.Client/ContextMenu/UI/ContextMenuUIController.cs @@ -86,7 +86,7 @@ namespace Content.Client.ContextMenu.UI Close(); RootMenu.OnPopupHide -= Close; - RootMenu.Dispose(); + RootMenu.Orphan(); RootMenu = default!; } diff --git a/Content.Client/ContextMenu/UI/EntityMenuElement.cs b/Content.Client/ContextMenu/UI/EntityMenuElement.cs index 175693810a..4c58f9f2e3 100644 --- a/Content.Client/ContextMenu/UI/EntityMenuElement.cs +++ b/Content.Client/ContextMenu/UI/EntityMenuElement.cs @@ -41,9 +41,9 @@ namespace Content.Client.ContextMenu.UI UpdateEntity(); } - protected override void Dispose(bool disposing) + protected override void ExitedTree() { - base.Dispose(disposing); + base.ExitedTree(); Entity = null; Count = 0; } diff --git a/Content.Client/ContextMenu/UI/EntityMenuUIController.cs b/Content.Client/ContextMenu/UI/EntityMenuUIController.cs index 19c0e5cb6c..1674a3bc1b 100644 --- a/Content.Client/ContextMenu/UI/EntityMenuUIController.cs +++ b/Content.Client/ContextMenu/UI/EntityMenuUIController.cs @@ -312,7 +312,7 @@ namespace Content.Client.ContextMenu.UI // remove the element var parent = element.ParentMenu?.ParentElement; - element.Dispose(); + element.Orphan(); Elements.Remove(entity); // update any parent elements @@ -340,7 +340,7 @@ namespace Content.Client.ContextMenu.UI if (entity == null) { // This whole element has no associated entities. We should remove it - element.Dispose(); + element.Orphan(); return; } @@ -352,7 +352,7 @@ namespace Content.Client.ContextMenu.UI // There was only one entity in the sub-menu. So we will just remove the sub-menu and point directly to // that entity. element.Entity = entity; - element.SubMenu.Dispose(); + element.SubMenu.Orphan(); element.SubMenu = null; Elements[entity.Value] = element; } diff --git a/Content.Client/CrewManifest/CrewManifestSystem.cs b/Content.Client/CrewManifest/CrewManifestSystem.cs index 2899ed4cd2..9a1d94d559 100644 --- a/Content.Client/CrewManifest/CrewManifestSystem.cs +++ b/Content.Client/CrewManifest/CrewManifestSystem.cs @@ -6,8 +6,6 @@ namespace Content.Client.CrewManifest; public sealed partial class CrewManifestSystem : EntitySystem { - [Dependency] private IPrototypeManager _prototypeManager = default!; - private Dictionary> _jobDepartmentLookup = new(); private HashSet _departments = new(); @@ -40,7 +38,7 @@ public sealed partial class CrewManifestSystem : EntitySystem { _jobDepartmentLookup.Clear(); _departments.Clear(); - foreach (var department in _prototypeManager.EnumeratePrototypes()) + foreach (var department in ProtoMan.EnumeratePrototypes()) { _departments.Add(department.ID); diff --git a/Content.Client/Damage/DamageVisualsSystem.cs b/Content.Client/Damage/DamageVisualsSystem.cs index a2182dd93c..b374831059 100644 --- a/Content.Client/Damage/DamageVisualsSystem.cs +++ b/Content.Client/Damage/DamageVisualsSystem.cs @@ -28,7 +28,6 @@ namespace Content.Client.Damage; /// public sealed partial class DamageVisualsSystem : VisualizerSystem { - [Dependency] private IPrototypeManager _prototypeManager = default!; [Dependency] private DamageableSystem _damageable = default!; public override void Initialize() @@ -153,7 +152,7 @@ public sealed partial class DamageVisualsSystem : VisualizerSystem(injurableComponent.DamageContainer, out var damageContainer)) + && ProtoMan.Resolve(injurableComponent.DamageContainer, out var damageContainer)) { // Are we using damage overlay sprites by group? // Check if the container matches the supported groups, @@ -189,7 +188,7 @@ public sealed partial class DamageVisualsSystem : VisualizerSystem() + var damagePrototypeIdList = ProtoMan.EnumeratePrototypes() .Select((p, _) => p.ID) .ToList(); if (damageVisComp.DamageOverlayGroups != null) @@ -524,7 +523,7 @@ public sealed partial class DamageVisualsSystem : VisualizerSystem(damageGroup, out var damageGroupPrototype) + if (!ProtoMan.TryIndex(damageGroup, out var damageGroupPrototype) || !damage.TryGetDamageInGroup(damageGroupPrototype, out var damageTotal)) continue; diff --git a/Content.Client/Decals/DecalPlacementSystem.cs b/Content.Client/Decals/DecalPlacementSystem.cs index bab9c9b688..7bbb05b29f 100644 --- a/Content.Client/Decals/DecalPlacementSystem.cs +++ b/Content.Client/Decals/DecalPlacementSystem.cs @@ -19,10 +19,10 @@ public sealed partial class DecalPlacementSystem : EntitySystem { [Dependency] private IInputManager _inputManager = default!; [Dependency] private IOverlayManager _overlay = default!; - [Dependency] private IPrototypeManager _protoMan = default!; [Dependency] private InputSystem _inputSystem = default!; [Dependency] private MetaDataSystem _metaData = default!; [Dependency] private SharedActionsSystem _actions = default!; + [Dependency] private SharedMapSystem _maps = default!; [Dependency] private SharedTransformSystem _transform = default!; [Dependency] private SpriteSystem _sprite = default!; @@ -42,14 +42,14 @@ public sealed partial class DecalPlacementSystem : EntitySystem public (DecalPrototype? Decal, bool Snap, Angle Angle, Color Color) GetActiveDecal() { return _active && _decalId != null ? - (_protoMan.Index(_decalId), _snap, _decalAngle, _decalColor) : + (ProtoMan.Index(_decalId), _snap, _decalAngle, _decalColor) : (null, false, Angle.Zero, Color.Wheat); } public override void Initialize() { base.Initialize(); - _overlay.AddOverlay(new DecalPlacementOverlay(this, _transform, _sprite)); + _overlay.AddOverlay(new DecalPlacementOverlay(this, _maps, _transform, _sprite)); CommandBinds.Builder.Bind(EngineKeyFunctions.EditorPlaceObject, new PointerStateInputCmdHandler( (session, coords, uid) => @@ -143,7 +143,7 @@ public sealed partial class DecalPlacementSystem : EntitySystem if (ev.Action != null) return; - if (_decalId == null || !_protoMan.TryIndex(_decalId, out var decalProto)) + if (_decalId == null || !ProtoMan.TryIndex(_decalId, out var decalProto)) return; var actionEvent = new PlaceDecalActionEvent() diff --git a/Content.Client/Decals/DecalSystem.cs b/Content.Client/Decals/DecalSystem.cs index 2b4b7c6583..54fcacf97e 100644 --- a/Content.Client/Decals/DecalSystem.cs +++ b/Content.Client/Decals/DecalSystem.cs @@ -22,7 +22,7 @@ namespace Content.Client.Decals { base.Initialize(); - _overlay = new DecalOverlay(_sprites, EntityManager, PrototypeManager); + _overlay = new DecalOverlay(_sprites, EntityManager, ProtoMan); _overlayManager.AddOverlay(_overlay); SubscribeLocalEvent(OnHandleState); diff --git a/Content.Client/Decals/Overlays/DecalPlacementOverlay.cs b/Content.Client/Decals/Overlays/DecalPlacementOverlay.cs index e0e73af5f7..a9e68b32f6 100644 --- a/Content.Client/Decals/Overlays/DecalPlacementOverlay.cs +++ b/Content.Client/Decals/Overlays/DecalPlacementOverlay.cs @@ -3,8 +3,6 @@ using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.Input; using Robust.Shared.Enums; -using Robust.Shared.Map; -using Robust.Shared.Prototypes; namespace Content.Client.Decals.Overlays; @@ -12,17 +10,18 @@ public sealed partial class DecalPlacementOverlay : Overlay { [Dependency] private IEyeManager _eyeManager = default!; [Dependency] private IInputManager _inputManager = default!; - [Dependency] private IMapManager _mapManager = default!; private readonly DecalPlacementSystem _placement; + private readonly SharedMapSystem _maps; private readonly SharedTransformSystem _transform; private readonly SpriteSystem _sprite; public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities; - public DecalPlacementOverlay(DecalPlacementSystem placement, SharedTransformSystem transform, SpriteSystem sprite) + public DecalPlacementOverlay(DecalPlacementSystem placement, SharedMapSystem maps, SharedTransformSystem transform, SpriteSystem sprite) { IoCManager.InjectDependencies(this); _placement = placement; + _maps = maps; _transform = transform; _sprite = sprite; ZIndex = 1000; @@ -42,7 +41,7 @@ public sealed partial class DecalPlacementOverlay : Overlay return; // No map support for decals - if (!_mapManager.TryFindGridAt(mousePos, out var gridUid, out var grid)) + if (!_maps.TryFindGridAt(mousePos, out var gridUid, out var grid)) { return; } diff --git a/Content.Client/Delivery/DeliveryVisualizerSystem.cs b/Content.Client/Delivery/DeliveryVisualizerSystem.cs index 10935f0faa..6b6e93d6a2 100644 --- a/Content.Client/Delivery/DeliveryVisualizerSystem.cs +++ b/Content.Client/Delivery/DeliveryVisualizerSystem.cs @@ -8,7 +8,6 @@ namespace Content.Client.Delivery; public sealed partial class DeliveryVisualizerSystem : VisualizerSystem { [Dependency] private SharedAppearanceSystem _appearance = default!; - [Dependency] private IPrototypeManager _prototype = default!; private static readonly ProtoId UnknownIcon = "JobIconUnknown"; @@ -22,9 +21,9 @@ public sealed partial class DeliveryVisualizerSystem : VisualizerSystem(job, out var icon)) + if (!ProtoMan.TryIndex(job, out var icon)) { - SpriteSystem.LayerSetTexture((uid, args.Sprite), DeliveryVisualLayers.JobStamp, SpriteSystem.Frame0(_prototype.Index(UnknownIcon).Icon)); + SpriteSystem.LayerSetTexture((uid, args.Sprite), DeliveryVisualLayers.JobStamp, SpriteSystem.Frame0(ProtoMan.Index(UnknownIcon).Icon)); return; } diff --git a/Content.Client/DoAfter/DoAfterSystem.cs b/Content.Client/DoAfter/DoAfterSystem.cs index 0c6bf1fb19..7bf968115a 100644 --- a/Content.Client/DoAfter/DoAfterSystem.cs +++ b/Content.Client/DoAfter/DoAfterSystem.cs @@ -1,9 +1,7 @@ using System.Diagnostics.CodeAnalysis; using Content.Shared.DoAfter; -using Content.Shared.Hands.Components; using Robust.Client.Graphics; using Robust.Client.Player; -using Robust.Shared.Prototypes; namespace Content.Client.DoAfter; @@ -15,13 +13,12 @@ public sealed partial class DoAfterSystem : SharedDoAfterSystem { [Dependency] private IOverlayManager _overlay = default!; [Dependency] private IPlayerManager _player = default!; - [Dependency] private IPrototypeManager _prototype = default!; [Dependency] private MetaDataSystem _metadata = default!; public override void Initialize() { base.Initialize(); - _overlay.AddOverlay(new DoAfterOverlay(EntityManager, _prototype, GameTiming, _player)); + _overlay.AddOverlay(new DoAfterOverlay(EntityManager, ProtoMan, GameTiming, _player)); } public override void Shutdown() diff --git a/Content.Client/Doors/DoorSystem.cs b/Content.Client/Doors/DoorSystem.cs index 7b2ac18280..d72589fed6 100644 --- a/Content.Client/Doors/DoorSystem.cs +++ b/Content.Client/Doors/DoorSystem.cs @@ -3,15 +3,12 @@ using Content.Shared.Doors.Systems; using Content.Shared.SprayPainter.Prototypes; using Robust.Client.Animations; using Robust.Client.GameObjects; -using Robust.Shared.Prototypes; namespace Content.Client.Doors; public sealed partial class DoorSystem : SharedDoorSystem { [Dependency] private AnimationPlayerSystem _animationSystem = default!; - [Dependency] private IComponentFactory _componentFactory = default!; - [Dependency] private IPrototypeManager _prototypeManager = default!; [Dependency] private SpriteSystem _sprite = default!; public override void Initialize() @@ -209,10 +206,10 @@ public sealed partial class DoorSystem : SharedDoorSystem private void UpdateSpriteLayers(Entity sprite, string targetProto) { - if (!_prototypeManager.Resolve(targetProto, out var target)) + if (!ProtoMan.Resolve(targetProto, out var target)) return; - if (!target.TryGetComponent(out SpriteComponent? targetSprite, _componentFactory)) + if (!target.TryComp(out SpriteComponent? targetSprite, Factory)) return; _sprite.SetBaseRsi(sprite.AsNullable(), targetSprite.BaseRSI); diff --git a/Content.Client/Eui/EuiManager.cs b/Content.Client/Eui/EuiManager.cs index 03ab3d2f7e..0682d6f879 100644 --- a/Content.Client/Eui/EuiManager.cs +++ b/Content.Client/Eui/EuiManager.cs @@ -18,6 +18,9 @@ namespace Content.Client.Eui private readonly Dictionary _openUis = new(); + /// + /// Initialisation of the EuiManager. + /// public void Initialize() { _net.RegisterNetMessage(RxMsgCtl); diff --git a/Content.Client/Examine/ExamineSystem.cs b/Content.Client/Examine/ExamineSystem.cs index 1fce277251..9e6fbb0e49 100644 --- a/Content.Client/Examine/ExamineSystem.cs +++ b/Content.Client/Examine/ExamineSystem.cs @@ -386,6 +386,10 @@ namespace Content.Client.Examine vbox.AddChild(buttonsHBox); } + /// + /// Handler for the OnClick Event of a Verb Button. + /// + /// The event args public void VerbButtonPressed(BaseButton.ButtonEventArgs obj) { if (obj.Button is ExamineButton button) @@ -396,6 +400,12 @@ namespace Content.Client.Examine } } + /// + /// Open and fills by query to server an examine menu with the correct tooltip and menu items. + /// + /// The entity examined. + /// If the popup should be on the cursor or the entity's screen position. + /// An optional user object; if null we assume the client's player entity. public void DoExamine(EntityUid entity, bool centeredOnCursor = true, EntityUid? userOverride = null) { var playerEnt = userOverride ?? _playerManager.LocalEntity; diff --git a/Content.Client/Explosion/ClusterGrenadeVisualsComponent.cs b/Content.Client/Explosion/ClusterGrenadeVisualsComponent.cs index 3c97f557b6..59db451b9a 100644 --- a/Content.Client/Explosion/ClusterGrenadeVisualsComponent.cs +++ b/Content.Client/Explosion/ClusterGrenadeVisualsComponent.cs @@ -1,9 +1,18 @@ +using Content.Shared.Explosion.EntitySystems; namespace Content.Client.Explosion; +/// +/// The Visual Component for the Cluster Grenade. +/// +/// [RegisterComponent] [Access(typeof(ClusterGrenadeVisualizerSystem))] public sealed partial class ClusterGrenadeVisualsComponent : Component { + /// + /// Used to select the correct layer from the rsi together with the grenade amount. + /// + /// [DataField("state")] public string? State; } diff --git a/Content.Client/Explosion/ExplosionOverlaySystem.cs b/Content.Client/Explosion/ExplosionOverlaySystem.cs index 98923a48dd..5cde7b5f4e 100644 --- a/Content.Client/Explosion/ExplosionOverlaySystem.cs +++ b/Content.Client/Explosion/ExplosionOverlaySystem.cs @@ -4,7 +4,6 @@ using Robust.Client.Graphics; using Robust.Client.ResourceManagement; using Robust.Shared.GameStates; using Robust.Shared.Graphics.RSI; -using Robust.Shared.Prototypes; namespace Content.Client.Explosion; @@ -14,7 +13,6 @@ namespace Content.Client.Explosion; /// public sealed partial class ExplosionOverlaySystem : EntitySystem { - [Dependency] private IPrototypeManager _protoMan = default!; [Dependency] private IResourceCache _resCache = default!; [Dependency] private IOverlayManager _overlayMan = default!; [Dependency] private SharedPointLightSystem _lights = default!; @@ -61,7 +59,7 @@ public sealed partial class ExplosionOverlaySystem : EntitySystem { EnsureComp(uid); - if (!_protoMan.TryIndex(component.ExplosionType, out ExplosionPrototype? type) || + if (!ProtoMan.TryIndex(component.ExplosionType, out ExplosionPrototype? type) || !TryComp(uid, out ExplosionVisualsTexturesComponent? textures)) { return; diff --git a/Content.Client/Explosion/ExplosionVisualsTexturesComponent.cs b/Content.Client/Explosion/ExplosionVisualsTexturesComponent.cs index b8641e6cee..7a58fed413 100644 --- a/Content.Client/Explosion/ExplosionVisualsTexturesComponent.cs +++ b/Content.Client/Explosion/ExplosionVisualsTexturesComponent.cs @@ -3,6 +3,9 @@ using Robust.Shared.Graphics; namespace Content.Client.Explosion; +/// +/// The client side visuals system for explosions. +/// [RegisterComponent] public sealed partial class ExplosionVisualsTexturesComponent : Component { diff --git a/Content.Client/Gameplay/GameplayStateBase.cs b/Content.Client/Gameplay/GameplayStateBase.cs index 97c6e8a8b2..975164722f 100644 --- a/Content.Client/Gameplay/GameplayStateBase.cs +++ b/Content.Client/Gameplay/GameplayStateBase.cs @@ -37,7 +37,6 @@ namespace Content.Client.Gameplay [Dependency] private IPlayerManager _playerManager = default!; [Dependency] private IEntitySystemManager _entitySystemManager = default!; [Dependency] private IGameTiming _timing = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] protected IUserInterfaceManager UserInterfaceManager = default!; [Dependency] private IEntityManager _entityManager = default!; [Dependency] private IViewVariablesManager _vvm = default!; @@ -240,7 +239,7 @@ namespace Content.Client.Gameplay var transformSystem = _entitySystemManager.GetEntitySystem(); var mapSystem = _entitySystemManager.GetEntitySystem(); - coordinates = _mapManager.TryFindGridAt(mousePosWorld, out var uid, out _) ? + coordinates = mapSystem.TryFindGridAt(mousePosWorld, out var uid, out _) ? mapSystem.MapToGrid(uid, mousePosWorld) : transformSystem.ToCoordinates(mousePosWorld); } diff --git a/Content.Client/Holopad/HolopadSystem.cs b/Content.Client/Holopad/HolopadSystem.cs index 81a04cf36b..2f22c66d4d 100644 --- a/Content.Client/Holopad/HolopadSystem.cs +++ b/Content.Client/Holopad/HolopadSystem.cs @@ -2,7 +2,6 @@ using Content.Shared.Chat.TypingIndicator; using Content.Shared.Holopad; using Robust.Client.GameObjects; using Robust.Client.Graphics; -using Robust.Shared.Prototypes; using Robust.Shared.Timing; using System.Linq; using System.Numerics; @@ -12,7 +11,6 @@ namespace Content.Client.Holopad; public sealed partial class HolopadSystem : SharedHolopadSystem { - [Dependency] private IPrototypeManager _prototypeManager = default!; [Dependency] private IGameTiming _timing = default!; [Dependency] private SpriteSystem _sprite = default!; @@ -120,7 +118,7 @@ public sealed partial class HolopadSystem : SharedHolopadSystem // Find the texture height of the largest layer float texHeight = sprite.AllLayers.Max(x => x.PixelSize.Y); - var instance = _prototypeManager.Index(holopadHologram.ShaderName).InstanceUnique(); + var instance = ProtoMan.Index(holopadHologram.ShaderName).InstanceUnique(); instance.SetParameter("color1", new Vector3(holopadHologram.Color1.R, holopadHologram.Color1.G, holopadHologram.Color1.B)); instance.SetParameter("color2", new Vector3(holopadHologram.Color2.R, holopadHologram.Color2.G, holopadHologram.Color2.B)); instance.SetParameter("alpha", holopadHologram.Alpha); diff --git a/Content.Client/Interaction/DragDropSystem.cs b/Content.Client/Interaction/DragDropSystem.cs index 467c138b2a..c38bf138ad 100644 --- a/Content.Client/Interaction/DragDropSystem.cs +++ b/Content.Client/Interaction/DragDropSystem.cs @@ -37,7 +37,6 @@ public sealed partial class DragDropSystem : SharedDragDropSystem [Dependency] private IInputManager _inputManager = default!; [Dependency] private IEyeManager _eyeManager = default!; [Dependency] private IPlayerManager _playerManager = default!; - [Dependency] private IPrototypeManager _prototypeManager = default!; [Dependency] private IConfigurationManager _cfgMan = default!; [Dependency] private InteractionOutlineSystem _outline = default!; [Dependency] private SharedInteractionSystem _interactionSystem = default!; @@ -112,8 +111,8 @@ public sealed partial class DragDropSystem : SharedDragDropSystem Subs.CVar(_cfgMan, CCVars.DragDropDeadZone, SetDeadZone, true); - _dropTargetInRangeShader = _prototypeManager.Index(ShaderDropTargetInRange).Instance(); - _dropTargetOutOfRangeShader = _prototypeManager.Index(ShaderDropTargetOutOfRange).Instance(); + _dropTargetInRangeShader = ProtoMan.Index(ShaderDropTargetInRange).Instance(); + _dropTargetOutOfRangeShader = ProtoMan.Index(ShaderDropTargetOutOfRange).Instance(); // needs to fire on mouseup and mousedown so we can detect a drag / drop CommandBinds.Builder .BindBefore(EngineKeyFunctions.Use, new PointerInputCmdHandler(OnUse, false, true), new[] { typeof(SharedInteractionSystem) }) diff --git a/Content.Client/Inventory/ClientInventorySystem.cs b/Content.Client/Inventory/ClientInventorySystem.cs index 00b9548aa9..ac606a39b2 100644 --- a/Content.Client/Inventory/ClientInventorySystem.cs +++ b/Content.Client/Inventory/ClientInventorySystem.cs @@ -1,6 +1,7 @@ using System.Linq; using Content.Client.Clothing; using Content.Client.Examine; +using Content.Client.Pointing; using Content.Client.Verbs.UI; using Content.Shared.Interaction; using Content.Shared.Inventory; @@ -23,6 +24,7 @@ namespace Content.Client.Inventory [Dependency] private IUserInterfaceManager _ui = default!; [Dependency] private ClientClothingSystem _clothingVisualsSystem = default!; [Dependency] private ExamineSystem _examine = default!; + [Dependency] private PointingSystem _pointing = default!; public Action? EntitySlotUpdate = null; public Action? OnSlotAdded = null; @@ -237,6 +239,19 @@ namespace Content.Client.Inventory RaisePredictiveEvent(new InteractInventorySlotEvent(GetNetEntity(item.Value), altInteract: true)); } + /// + /// Points at an item in the inventory + /// + /// The slot to point at + /// The inventory entity containing the slot + public void UIInventoryPointAt(string slot, EntityUid uid) + { + if (!TryGetSlotEntity(uid, slot, out var item)) + return; + + _pointing.TryPointAtEntity(GetNetEntity(item.Value)); + } + protected override void UpdateInventoryTemplate(Entity ent) { base.UpdateInventoryTemplate(ent); diff --git a/Content.Client/Light/AmbientOcclusionOverlay.cs b/Content.Client/Light/AmbientOcclusionOverlay.cs index ef510a2d26..68b8bc72a3 100644 --- a/Content.Client/Light/AmbientOcclusionOverlay.cs +++ b/Content.Client/Light/AmbientOcclusionOverlay.cs @@ -5,7 +5,7 @@ using Content.Shared.Maps; using Robust.Client.Graphics; using Robust.Shared.Configuration; using Robust.Shared.Enums; -using Robust.Shared.Map; +using Robust.Shared.Map.Components; using Robust.Shared.Prototypes; using Robust.Shared.Utility; @@ -23,9 +23,10 @@ public sealed partial class AmbientOcclusionOverlay : Overlay [Dependency] private IClyde _clyde = default!; [Dependency] private IConfigurationManager _cfgManager = default!; [Dependency] private IEntityManager _entManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IPrototypeManager _proto = default!; + private List> _cachedGrids = new(); + public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowEntities; private readonly OverlayResourceCache _resources = new (); @@ -115,7 +116,9 @@ public sealed partial class AmbientOcclusionOverlay : Overlay // Don't want lighting affecting it. worldHandle.UseShader(_proto.Index(UnshadedShader).Instance()); - foreach (var grid in _mapManager.FindGridsIntersecting(mapId, worldBounds)) + _cachedGrids.Clear(); + maps.FindGridsIntersecting(mapId, worldBounds, ref _cachedGrids); + foreach (var grid in _cachedGrids) { var transform = xformSystem.GetWorldMatrix(grid.Owner); var worldToTextureMatrix = Matrix3x2.Multiply(transform, invMatrix); @@ -126,7 +129,7 @@ public sealed partial class AmbientOcclusionOverlay : Overlay if (turfSystem.IsSpace(tileRef)) continue; - var bounds = lookups.GetLocalBounds(tileRef, grid.TileSize); + var bounds = lookups.GetLocalBounds(tileRef, grid.Comp.TileSize); worldHandle.DrawRect(bounds, Color.White); } } diff --git a/Content.Client/Light/RoofOverlay.cs b/Content.Client/Light/RoofOverlay.cs index 7923601fa9..934c2bc001 100644 --- a/Content.Client/Light/RoofOverlay.cs +++ b/Content.Client/Light/RoofOverlay.cs @@ -14,7 +14,6 @@ namespace Content.Client.Light; public sealed partial class RoofOverlay : Overlay { private readonly IEntityManager _entManager; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IOverlayManager _overlay = default!; private readonly EntityLookupSystem _lookup; @@ -56,7 +55,7 @@ public sealed partial class RoofOverlay : Overlay var target = lightRes.EnlargedLightTarget; _grids.Clear(); - _mapManager.FindGridsIntersecting(args.MapId, bounds, ref _grids, approx: true, includeMap: true); + _mapSystem.FindGridsIntersecting(args.MapId, bounds, ref _grids, approx: true, includeMap: true); var lightScale = viewport.LightRenderTarget.Size / (Vector2) viewport.Size; var scale = viewport.RenderScale / (Vector2.One / lightScale); diff --git a/Content.Client/Light/SunShadowOverlay.cs b/Content.Client/Light/SunShadowOverlay.cs index abdd69d667..4f16f63624 100644 --- a/Content.Client/Light/SunShadowOverlay.cs +++ b/Content.Client/Light/SunShadowOverlay.cs @@ -18,9 +18,9 @@ public sealed partial class SunShadowOverlay : Overlay [Dependency] private IClyde _clyde = default!; [Dependency] private IEntityManager _entManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IPrototypeManager _protoManager = default!; private readonly EntityLookupSystem _lookup; + private readonly SharedMapSystem _mapSys; private readonly SharedTransformSystem _xformSys; private readonly HashSet> _shadows = new(); @@ -31,6 +31,7 @@ public sealed partial class SunShadowOverlay : Overlay { IoCManager.InjectDependencies(this); _xformSys = _entManager.System(); + _mapSys = _entManager.System(); _lookup = _entManager.System(); ZIndex = AfterLightTargetOverlay.ContentZIndex + 1; } @@ -46,7 +47,7 @@ public sealed partial class SunShadowOverlay : Overlay return; _grids.Clear(); - _mapManager.FindGridsIntersecting(args.MapId, + _mapSys.FindGridsIntersecting(args.MapId, args.WorldBounds.Enlarged(SunShadowComponent.MaxLength), ref _grids); diff --git a/Content.Client/Light/TileEmissionOverlay.cs b/Content.Client/Light/TileEmissionOverlay.cs index 448a5b3639..743dd9d513 100644 --- a/Content.Client/Light/TileEmissionOverlay.cs +++ b/Content.Client/Light/TileEmissionOverlay.cs @@ -11,7 +11,6 @@ public sealed partial class TileEmissionOverlay : Overlay { public override OverlaySpace Space => OverlaySpace.BeforeLighting; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IOverlayManager _overlay = default!; private SharedMapSystem _mapSystem; @@ -50,7 +49,7 @@ public sealed partial class TileEmissionOverlay : Overlay var target = lightoverlay.GetCachedForViewport(args.Viewport).EnlargedLightTarget; var viewport = args.Viewport; _grids.Clear(); - _mapManager.FindGridsIntersecting(mapId, bounds, ref _grids, approx: true); + _mapSystem.FindGridsIntersecting(mapId, bounds, ref _grids, approx: true); if (_grids.Count == 0) return; diff --git a/Content.Client/Lobby/UI/HumanoidProfileEditor.Appearance.cs b/Content.Client/Lobby/UI/HumanoidProfileEditor.Appearance.cs index 75fff23d44..7f6beb9acf 100644 --- a/Content.Client/Lobby/UI/HumanoidProfileEditor.Appearance.cs +++ b/Content.Client/Lobby/UI/HumanoidProfileEditor.Appearance.cs @@ -1,9 +1,11 @@ using System.Linq; using Content.Client.UserInterface.Systems.Guidebook; +using Content.Shared.Chat.Prototypes; using Content.Shared.Guidebook; using Content.Shared.Humanoid; using Content.Shared.Humanoid.Prototypes; using Content.Shared.Preferences; +using Content.Shared.Speech.Components; using Robust.Client.UserInterface.Controls; using Robust.Shared.Enums; using Robust.Shared.Prototypes; @@ -17,6 +19,7 @@ public sealed partial class HumanoidProfileEditor private ColorSelectorSliders _rgbSkinColorSelector; private List _species = new(); + private List _voices = new(); private static readonly ProtoId DefaultSpeciesGuidebook = "Species"; public void UpdateSpeciesGuidebookIcon() @@ -98,6 +101,34 @@ public sealed partial class HumanoidProfileEditor EyeColorPicker.SetData(Profile.Appearance.EyeColor); } + private void UpdateVoiceControls() + { + if (Profile == null) + return; + + VoiceButton.Clear(); + _voices.Clear(); + + var speciesPrototype = _prototypeManager.Index(Profile.Species); + var availableVoices = speciesPrototype.Voices; + + _voices.AddRange(availableVoices.Select(protoId => _prototypeManager.Index(protoId))); + + if (_voices.All(proto => Profile?.Voice != proto.ID)) + SetVoice(speciesPrototype.DefaultSoundsBySex[(int)Profile.Sex]); + + for (var i = 0; i < availableVoices.Count; i++) + { + var name = Loc.GetString(_voices[i].VoiceSelectorName); + VoiceButton.AddItem(name, i); + + if (Profile?.Voice.Equals(_voices[i].ID) == true) + { + VoiceButton.SelectId(i); + } + } + } + private void UpdateSkinColor() { if (Profile == null) @@ -193,6 +224,7 @@ public sealed partial class HumanoidProfileEditor // In case there's species restrictions for loadouts RefreshLoadouts(); UpdateSexControls(); // update sex for new species + UpdateVoiceControls(); UpdateSpeciesGuidebookIcon(); ReloadPreview(); } @@ -220,12 +252,23 @@ public sealed partial class HumanoidProfileEditor break; } + // this does the same as above but for voice + if (_prototypeManager.TryIndex(Profile?.Species, out var prototype)) + SetVoice(prototype.DefaultSoundsBySex[(int)newSex]); + UpdateGenderControls(); + UpdateVoiceControls(); UpdateTTSVoicesControls(); // Corvax-TTS _markingsModel.SetOrganSexes(newSex); ReloadPreview(); } + private void SetVoice(ProtoId newVoice) + { + Profile = Profile?.WithVoice(newVoice); + IsDirty = true; + } + private void SetGender(Gender newGender) { Profile = Profile?.WithGender(newGender); diff --git a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml index fc278e2393..7536f0db27 100644 --- a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml +++ b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml @@ -74,6 +74,12 @@ + + +