Skip to content

Commit

Permalink
Merge branch 'master-ru' into arumoon-server
Browse files Browse the repository at this point in the history
  • Loading branch information
MilenVolf committed Sep 17, 2023
2 parents 6e95942 + 596009c commit ccb84f7
Show file tree
Hide file tree
Showing 337 changed files with 7,847 additions and 6,164 deletions.
6 changes: 3 additions & 3 deletions Content.Client/Buckle/BuckleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private void OnBuckleHandleState(EntityUid uid, BuckleComponent component, ref C
component.LastEntityBuckledTo = EnsureEntity<BuckleComponent>(state.LastEntityBuckledTo, uid);
component.DontCollide = state.DontCollide;

ActionBlockerSystem.UpdateCanMove(uid);
ActionBlocker.UpdateCanMove(uid);

if (!TryComp<SpriteComponent>(uid, out var ownerSprite))
return;
Expand Down Expand Up @@ -65,8 +65,8 @@ private void OnAppearanceChange(EntityUid uid, BuckleComponent component, ref Ap
if (!TryComp<RotationVisualsComponent>(uid, out var rotVisuals))
return;

if (!AppearanceSystem.TryGetData<int>(uid, StrapVisuals.RotationAngle, out var angle, args.Component) ||
!AppearanceSystem.TryGetData<bool>(uid, BuckleVisuals.Buckled, out var buckled, args.Component) ||
if (!Appearance.TryGetData<int>(uid, StrapVisuals.RotationAngle, out var angle, args.Component) ||
!Appearance.TryGetData<bool>(uid, BuckleVisuals.Buckled, out var buckled, args.Component) ||
!buckled ||
args.Sprite == null)
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/CharacterInfo/CharacterInfoSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public List<Control> GetCharacterInfoControls(EntityUid uid)
public readonly record struct CharacterData(
EntityUid Entity,
string Job,
Dictionary<string, List<ConditionInfo>> Objectives,
Dictionary<string, List<ObjectiveInfo>> Objectives,
string? Briefing,
string EntityName
);
Expand Down
5 changes: 4 additions & 1 deletion Content.Client/ContextMenu/UI/EntityMenuElement.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using System.Linq;
using Content.Client.Administration.Managers;
using Content.Client.Administration.Systems;
using Content.Client.UserInterface;
using Content.Shared.Administration;
using Content.Shared.IdentityManagement;
using Robust.Client.GameObjects;
using Robust.Client.Player;

namespace Content.Client.ContextMenu.UI
{
public sealed partial class EntityMenuElement : ContextMenuElement
public sealed partial class EntityMenuElement : ContextMenuElement, IEntityControl
{
[Dependency] private readonly IClientAdminManager _adminManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
Expand Down Expand Up @@ -117,5 +118,7 @@ public void UpdateEntity(EntityUid? entity = null)
Text = GetEntityDescription(entity.Value);
}
}

EntityUid? IEntityControl.UiEntity => Entity;
}
}
1 change: 1 addition & 0 deletions Content.Client/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public override void PostInit()
_euiManager.Initialize();
_voteManager.Initialize();
_userInterfaceManager.SetDefaultTheme("SS14DefaultTheme");
_userInterfaceManager.SetActiveTheme(_configManager.GetCVar(CVars.InterfaceTheme));
_documentParsingManager.Initialize();

_baseClient.RunLevelChanged += (_, args) =>
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/GameTicking/Managers/ClientGameTicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ private void LateJoinStatus(TickerLateJoinStatusEvent message)

private void UpdateJobsAvailable(TickerJobsAvailableEvent message)
{
_jobsAvailable.Clear();

foreach (var (job, data) in message.JobsAvailableByStation)
{
_jobsAvailable.Clear();
_jobsAvailable[job] = data;
}

Expand Down
60 changes: 40 additions & 20 deletions Content.Client/Gameplay/GameplayStateBase.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Content.Client.Clickable;
using Content.Client.ContextMenu.UI;
using Content.Client.UserInterface;
using Content.Shared.Input;
using Robust.Client.ComponentTrees;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.Player;
using Robust.Client.State;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Containers;
using Robust.Shared.Console;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Map;
using Robust.Shared.Players;
using Robust.Shared.Timing;

namespace Content.Client.Gameplay
Expand All @@ -34,28 +36,36 @@ public class GameplayStateBase : State, IEntityEventSubscriber
[Dependency] protected readonly IUserInterfaceManager UserInterfaceManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IViewVariablesManager _vvm = default!;
[Dependency] private readonly IConsoleHost _conHost = default!;

private ClickableEntityComparer _comparer = default!;

private (ViewVariablesPath? path, string[] segments) ResolveVVHoverObject(string path)
private (ViewVariablesPath? path, string[] segments) ResolveVvHoverObject(string path)
{
// VVs the currently hovered entity. For a nifty vv keybinding you can use:
//
// /bind v command "vv /c/enthover"
// /svbind
//
// Though you probably want to include a modifier like alt, as otherwise this would open VV even when typing
// a message into chat containing the letter v.

var segments = path.Split('/');
var uid = RecursivelyFindUiEntity(UserInterfaceManager.CurrentlyHovered);
var netUid = _entityManager.GetNetEntity(uid);
return (netUid != null ? new ViewVariablesInstancePath(netUid) : null, segments);
}

EntityUid? uid = null;
if (UserInterfaceManager.CurrentlyHovered is IViewportControl vp && _inputManager.MouseScreenPosition.IsValid)
uid = GetClickedEntity(vp.PixelToMap(_inputManager.MouseScreenPosition.Position));
else if (UserInterfaceManager.CurrentlyHovered is EntityMenuElement element)
uid = element.Entity;
private EntityUid? RecursivelyFindUiEntity(Control? control)
{
if (control == null)
return null;

return (uid != null ? new ViewVariablesInstancePath(uid) : null, segments);
switch (control)
{
case IViewportControl vp:
if (_inputManager.MouseScreenPosition.IsValid)
return GetClickedEntity(vp.PixelToMap(_inputManager.MouseScreenPosition.Position));
return null;
case SpriteView sprite:
return sprite.Entity;
case IEntityControl ui:
return ui.UiEntity;
}

return RecursivelyFindUiEntity(control.Parent);
}

private IEnumerable<string>? ListVVHoverPaths(string[] segments)
Expand All @@ -65,15 +75,25 @@ public class GameplayStateBase : State, IEntityEventSubscriber

protected override void Startup()
{
_vvm.RegisterDomain("enthover", ResolveVVHoverObject, ListVVHoverPaths);
_vvm.RegisterDomain("enthover", ResolveVvHoverObject, ListVVHoverPaths);
_inputManager.KeyBindStateChanged += OnKeyBindStateChanged;
_comparer = new ClickableEntityComparer();
CommandBinds.Builder
.Bind(ContentKeyFunctions.InspectEntity, new PointerInputCmdHandler(HandleInspect, outsidePrediction: true))
.Register<GameplayStateBase>();
}

protected override void Shutdown()
{
_vvm.UnregisterDomain("enthover");
_inputManager.KeyBindStateChanged -= OnKeyBindStateChanged;
CommandBinds.Unregister<GameplayStateBase>();
}

private bool HandleInspect(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
{
_conHost.ExecuteCommand($"vv /c/enthover");
return true;
}

public EntityUid? GetClickedEntity(MapCoordinates coordinates)
Expand Down
9 changes: 6 additions & 3 deletions Content.Client/Gateway/UI/GatewayBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected override void Open()
_window = new GatewayWindow();
_window.OpenPortal += destination =>
{
SendMessage(new GatewayOpenPortalMessage(EntMan.GetNetEntity(destination)));
SendMessage(new GatewayOpenPortalMessage(destination));
};
_window.OnClose += Close;
_window?.OpenCentered();
Expand All @@ -29,8 +29,11 @@ protected override void Open()
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_window?.Dispose();
_window = null;
if (disposing)
{
_window?.Dispose();
_window = null;
}
}

protected override void UpdateState(BoundUserInterfaceState state)
Expand Down
16 changes: 7 additions & 9 deletions Content.Client/Gateway/UI/GatewayWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ namespace Content.Client.Gateway.UI;
public sealed partial class GatewayWindow : FancyWindow,
IComputerWindow<EmergencyConsoleBoundUserInterfaceState>
{
private readonly IEntityManager _entManager;
private readonly IGameTiming _timing;

public event Action<EntityUid>? OpenPortal;
public event Action<NetEntity>? OpenPortal;
private List<(NetEntity, string, TimeSpan, bool)> _destinations = default!;
private EntityUid? _current;
private NetEntity? _current;
private TimeSpan _nextClose;
private TimeSpan _lastOpen;
private List<Label> _readyLabels = default!;
Expand All @@ -31,14 +30,13 @@ public GatewayWindow()
{
RobustXamlLoader.Load(this);
var dependencies = IoCManager.Instance!;
_entManager = dependencies.Resolve<IEntityManager>();
_timing = dependencies.Resolve<IGameTiming>();
}

public void UpdateState(GatewayBoundUserInterfaceState state)
{
_destinations = state.Destinations;
_current = _entManager.GetEntity(state.Current);
_current = state.Current;
_nextClose = state.NextClose;
_lastOpen = state.LastOpen;

Expand Down Expand Up @@ -67,7 +65,7 @@ public void UpdateState(GatewayBoundUserInterfaceState state)
var now = _timing.CurTime;
foreach (var dest in _destinations)
{
var uid = _entManager.GetEntity(dest.Item1);
var ent = dest.Item1;
var name = dest.Item2;
var nextReady = dest.Item3;
var busy = dest.Item4;
Expand All @@ -94,17 +92,17 @@ public void UpdateState(GatewayBoundUserInterfaceState state)
var openButton = new Button()
{
Text = Loc.GetString("gateway-window-open-portal"),
Pressed = uid == _current,
Pressed = ent == _current,
ToggleMode = true,
Disabled = _current != null || busy || now < nextReady
};

openButton.OnPressed += args =>
{
OpenPortal?.Invoke(uid);
OpenPortal?.Invoke(ent);
};

if (uid == _entManager.GetEntity(state.Current))
if (ent == _current)
{
openButton.AddStyleClass(StyleBase.ButtonCaution);
}
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static void SetupContexts(IInputContextContainer contexts)
common.AddFunction(ContentKeyFunctions.ZoomOut);
common.AddFunction(ContentKeyFunctions.ZoomIn);
common.AddFunction(ContentKeyFunctions.ResetZoom);
common.AddFunction(ContentKeyFunctions.InspectEntity);

// Not in engine, because engine cannot check for sanbox/admin status before starting placement.
common.AddFunction(ContentKeyFunctions.EditorCopyObject);
Expand Down
7 changes: 7 additions & 0 deletions Content.Client/Objectives/Systems/ObjectivesSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using Content.Shared.Objectives.Systems;

namespace Content.Client.Objectives.Systems;

public sealed class ObjectivesSystem : SharedObjectivesSystem
{
}
15 changes: 11 additions & 4 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public sealed partial class GraphicsTab : Control
2f
};

private Dictionary<string, int> hudThemeIdToIndex = new();

[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;

Expand Down Expand Up @@ -56,6 +58,7 @@ public GraphicsTab()
foreach (var gear in _prototypeManager.EnumeratePrototypes<HudThemePrototype>())
{
HudThemeOption.AddItem(Loc.GetString(gear.Name));
hudThemeIdToIndex.Add(gear.ID, HudThemeOption.GetItemId(HudThemeOption.ItemCount - 1));
}
HudThemeOption.OnItemSelected += OnHudThemeChanged;

Expand Down Expand Up @@ -109,7 +112,7 @@ public GraphicsTab()
FullscreenCheckBox.Pressed = ConfigIsFullscreen;
LightingPresetOption.SelectId(GetConfigLightingQuality());
UIScaleOption.SelectId(GetConfigUIScalePreset(ConfigUIScale));
HudThemeOption.SelectId(_cfg.GetCVar(CCVars.HudTheme));
HudThemeOption.SelectId(hudThemeIdToIndex.GetValueOrDefault(_cfg.GetCVar(CVars.InterfaceTheme), 0));
ViewportScaleSlider.Value = _cfg.GetCVar(CCVars.ViewportFixedScaleFactor);
ViewportStretchCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportStretch);
IntegerScalingCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportSnapToleranceMargin) != 0;
Expand Down Expand Up @@ -145,9 +148,13 @@ private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
{
_cfg.SetCVar(CVars.DisplayVSync, VSyncCheckBox.Pressed);
SetConfigLightingQuality(LightingPresetOption.SelectedId);
if (HudThemeOption.SelectedId != _cfg.GetCVar(CCVars.HudTheme)) // Don't unnecessarily redraw the HUD

foreach (var theme in _prototypeManager.EnumeratePrototypes<HudThemePrototype>())
{
_cfg.SetCVar(CCVars.HudTheme, HudThemeOption.SelectedId);
if (hudThemeIdToIndex[theme.ID] != HudThemeOption.SelectedId)
continue;
_cfg.SetCVar(CVars.InterfaceTheme, theme.ID);
break;
}

_cfg.SetCVar(CVars.DisplayWindowMode,
Expand Down Expand Up @@ -189,7 +196,7 @@ private void UpdateApplyButton()
var isVSyncSame = VSyncCheckBox.Pressed == _cfg.GetCVar(CVars.DisplayVSync);
var isFullscreenSame = FullscreenCheckBox.Pressed == ConfigIsFullscreen;
var isLightingQualitySame = LightingPresetOption.SelectedId == GetConfigLightingQuality();
var isHudThemeSame = HudThemeOption.SelectedId == _cfg.GetCVar(CCVars.HudTheme);
var isHudThemeSame = HudThemeOption.SelectedId == hudThemeIdToIndex.GetValueOrDefault(_cfg.GetCVar(CVars.InterfaceTheme), 0);
var isUIScaleSame = MathHelper.CloseToPercent(UIScaleOptions[UIScaleOption.SelectedId], ConfigUIScale);
var isVPStretchSame = ViewportStretchCheckBox.Pressed == _cfg.GetCVar(CCVars.ViewportStretch);
var isVPScaleSame = (int) ViewportScaleSlider.Value == _cfg.GetCVar(CCVars.ViewportFixedScaleFactor);
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ void AddCheckBox(string checkBoxName, bool currentState, Action<BaseButton.Butto
AddButton(EngineKeyFunctions.ShowDebugConsole);
AddButton(EngineKeyFunctions.ShowDebugMonitors);
AddButton(EngineKeyFunctions.HideUI);
AddButton(ContentKeyFunctions.InspectEntity);

foreach (var control in _keyControls.Values)
{
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Pinpointer/NavMapSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ private void OnHandleState(EntityUid uid, NavMapComponent component, ref Compone
TileData = data,
});
}

component.Beacons.Clear();
component.Beacons.AddRange(state.Beacons);
}
}

Expand Down
Loading

0 comments on commit ccb84f7

Please sign in to comment.