Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Merge branch 'pirata' of https://github.com/rbertoche/space-station-14
Browse files Browse the repository at this point in the history
…into pirata
  • Loading branch information
VictorJob committed Nov 20, 2023
2 parents 30b2ed7 + b19edb7 commit 37f5e17
Show file tree
Hide file tree
Showing 265 changed files with 9,259 additions and 7,733 deletions.
1 change: 1 addition & 0 deletions Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Robust.Shared.ContentPack;
using Robust.Shared.GameStates;
using Robust.Shared.Input.Binding;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager;
using Robust.Shared.Serialization.Markdown;
using Robust.Shared.Serialization.Markdown.Mapping;
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Alerts/ClientAlertsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Shared.Alert;
using JetBrains.Annotations;
using Robust.Client.Player;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Client.Alerts;
Expand Down
32 changes: 24 additions & 8 deletions Content.Client/Chat/UI/SpeechBubble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
using Robust.Shared.Utility;

namespace Content.Client.Chat.UI
{
Expand All @@ -13,7 +14,8 @@ public enum SpeechType : byte
{
Emote,
Say,
Whisper
Whisper,
Looc
}

/// <summary>
Expand Down Expand Up @@ -60,12 +62,15 @@ public static SpeechBubble CreateSpeechBubble(SpeechType type, string text, Enti
case SpeechType.Whisper:
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "whisperBox");

case SpeechType.Looc:
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "emoteBox", Color.FromHex("#48d1cc"));

default:
throw new ArgumentOutOfRangeException();
}
}

public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass)
public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass, Color? fontColor = null)
{
_chatManager = chatManager;
_senderEntity = senderEntity;
Expand All @@ -75,7 +80,7 @@ public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager,
// Use text clipping so new messages don't overlap old ones being pushed up.
RectClipContent = true;

var bubble = BuildBubble(text, speechStyleClass);
var bubble = BuildBubble(text, speechStyleClass, fontColor);

AddChild(bubble);

Expand All @@ -86,7 +91,7 @@ public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager,
_verticalOffsetAchieved = -ContentSize.Y;
}

protected abstract Control BuildBubble(string text, string speechStyleClass);
protected abstract Control BuildBubble(string text, string speechStyleClass, Color? fontColor = null);

protected override void FrameUpdate(FrameEventArgs args)
{
Expand Down Expand Up @@ -164,18 +169,29 @@ public void FadeNow()

public sealed class TextSpeechBubble : SpeechBubble
{
public TextSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass)
: base(text, senderEntity, eyeManager, chatManager, entityManager, speechStyleClass)
public TextSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass, Color? fontColor = null)
: base(text, senderEntity, eyeManager, chatManager, entityManager, speechStyleClass, fontColor)
{
}

protected override Control BuildBubble(string text, string speechStyleClass)
protected override Control BuildBubble(string text, string speechStyleClass, Color? fontColor = null)
{
var label = new RichTextLabel
{
MaxWidth = 256,
};
label.SetMessage(text);

if (fontColor != null)
{
var msg = new FormattedMessage();
msg.PushColor(fontColor.Value);
msg.AddMarkup(text);
label.SetMessage(msg);
}
else
{
label.SetMessage(text);
}

var panel = new PanelContainer
{
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Construction/ConstructionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Client.Construction
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Drugs/DrugOverlaySystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Shared.Drugs;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.Drugs;

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Drunk/DrunkSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Shared.Drunk;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.Drunk;

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Eye/Blinding/BlindingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Robust.Client.Player;
using Content.Shared.Eye.Blinding.Components;
using Content.Shared.GameTicking;
using Robust.Shared.Player;

namespace Content.Client.Eye.Blinding;

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Eye/Blinding/BlurryVisionSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Shared.Eye.Blinding.Components;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.Eye.Blinding;

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Eye/EyeLerpingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Robust.Client.GameObjects;
using Robust.Client.Physics;
using Robust.Client.Player;
using Robust.Shared.Player;
using Robust.Shared.Timing;

namespace Content.Client.Eye;
Expand Down
57 changes: 15 additions & 42 deletions Content.Client/Ghost/GhostSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.Ghost
{
Expand All @@ -13,8 +14,8 @@ public sealed class GhostSystem : SharedGhostSystem
[Dependency] private readonly IClientConsoleHost _console = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly ILightManager _lightManager = default!;
[Dependency] private readonly ContentEyeSystem _contentEye = default!;
[Dependency] private readonly EyeSystem _eye = default!;

public int AvailableGhostRoleCount { get; private set; }

Expand All @@ -35,7 +36,7 @@ private bool GhostVisibility
var query = AllEntityQuery<GhostComponent, SpriteComponent>();
while (query.MoveNext(out var uid, out _, out var sprite))
{
sprite.Visible = value || uid == _playerManager.LocalPlayer?.ControlledEntity;
sprite.Visible = value || uid == _playerManager.LocalEntity;
}
}
}
Expand All @@ -61,39 +62,37 @@ public override void Initialize()
SubscribeLocalEvent<GhostComponent, LocalPlayerAttachedEvent>(OnGhostPlayerAttach);
SubscribeLocalEvent<GhostComponent, LocalPlayerDetachedEvent>(OnGhostPlayerDetach);

SubscribeLocalEvent<LocalPlayerAttachedEvent>(OnPlayerAttach);

SubscribeNetworkEvent<GhostWarpsResponseEvent>(OnGhostWarpsResponse);
SubscribeNetworkEvent<GhostUpdateGhostRoleCountEvent>(OnUpdateGhostRoleCount);

SubscribeLocalEvent<GhostComponent, ToggleLightingActionEvent>(OnToggleLighting);
SubscribeLocalEvent<GhostComponent, ToggleFoVActionEvent>(OnToggleFoV);
SubscribeLocalEvent<EyeComponent, ToggleLightingActionEvent>(OnToggleLighting);
SubscribeLocalEvent<EyeComponent, ToggleFoVActionEvent>(OnToggleFoV);
SubscribeLocalEvent<GhostComponent, ToggleGhostsActionEvent>(OnToggleGhosts);
}

private void OnStartup(EntityUid uid, GhostComponent component, ComponentStartup args)
{
if (TryComp(uid, out SpriteComponent? sprite))
sprite.Visible = GhostVisibility;
sprite.Visible = GhostVisibility || uid == _playerManager.LocalEntity;
}

private void OnToggleLighting(EntityUid uid, GhostComponent component, ToggleLightingActionEvent args)
private void OnToggleLighting(EntityUid uid, EyeComponent component, ToggleLightingActionEvent args)
{
if (args.Handled)
return;

Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup"), args.Performer);
_lightManager.Enabled = !_lightManager.Enabled;
_contentEye.RequestToggleLight(uid, component);
args.Handled = true;
}

private void OnToggleFoV(EntityUid uid, GhostComponent component, ToggleFoVActionEvent args)
private void OnToggleFoV(EntityUid uid, EyeComponent component, ToggleFoVActionEvent args)
{
if (args.Handled)
return;

Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-fov-popup"), args.Performer);
_contentEye.RequestToggleFov(uid);
_contentEye.RequestToggleFov(uid, component);
args.Handled = true;
}

Expand All @@ -104,7 +103,7 @@ private void OnToggleGhosts(EntityUid uid, GhostComponent component, ToggleGhost

Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-ghost-visibility-popup"), args.Performer);

if (uid == _playerManager.LocalPlayer?.ControlledEntity)
if (uid == _playerManager.LocalEntity)
ToggleGhostVisibility();

args.Handled = true;
Expand All @@ -117,26 +116,16 @@ private void OnGhostRemove(EntityUid uid, GhostComponent component, ComponentRem
_actions.RemoveAction(uid, component.ToggleGhostsActionEntity);
_actions.RemoveAction(uid, component.ToggleGhostHearingActionEntity);

if (uid != _playerManager.LocalPlayer?.ControlledEntity)
if (uid != _playerManager.LocalEntity)
return;

_lightManager.Enabled = true;

if (component.IsAttached)
{
GhostVisibility = false;
}

GhostVisibility = false;
PlayerRemoved?.Invoke(component);
}

private void OnGhostPlayerAttach(EntityUid uid, GhostComponent component, LocalPlayerAttachedEvent localPlayerAttachedEvent)
{
if (uid != _playerManager.LocalPlayer?.ControlledEntity)
return;

GhostVisibility = true;
component.IsAttached = true;
PlayerAttached?.Invoke(component);
}

Expand All @@ -145,32 +134,16 @@ private void OnGhostState(EntityUid uid, GhostComponent component, ref AfterAuto
if (TryComp<SpriteComponent>(uid, out var sprite))
sprite.LayerSetColor(0, component.color);

if (uid != _playerManager.LocalPlayer?.ControlledEntity)
if (uid != _playerManager.LocalEntity)
return;

PlayerUpdated?.Invoke(component);
}

private bool PlayerDetach(EntityUid uid)
private void OnGhostPlayerDetach(EntityUid uid, GhostComponent component, LocalPlayerDetachedEvent args)
{
if (uid != _playerManager.LocalPlayer?.ControlledEntity)
return false;

GhostVisibility = false;
PlayerDetached?.Invoke();
return true;
}

private void OnGhostPlayerDetach(EntityUid uid, GhostComponent component, LocalPlayerDetachedEvent args)
{
if (PlayerDetach(uid))
component.IsAttached = false;
}

private void OnPlayerAttach(LocalPlayerAttachedEvent ev)
{
if (!HasComp<GhostComponent>(ev.Entity))
PlayerDetach(ev.Entity);
}

private void OnGhostWarpsResponse(GhostWarpsResponseEvent msg)
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Hands/Systems/HandsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Robust.Client.UserInterface;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Player;
using Robust.Shared.Timing;

namespace Content.Client.Hands.Systems
Expand Down
5 changes: 0 additions & 5 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ public static void SetupContexts(IInputContextContainer contexts)
common.AddFunction(boundKey);
}

foreach (var boundKey in ContentKeyFunctions.GetLoadoutBoundKeys())
{
common.AddFunction(boundKey);
}

var aghost = contexts.New("aghost", "common");
aghost.AddFunction(EngineKeyFunctions.MoveUp);
aghost.AddFunction(EngineKeyFunctions.MoveDown);
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Inventory/ClientInventorySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Robust.Client.UserInterface;
using Robust.Shared.Containers;
using Robust.Shared.Input.Binding;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Client.Inventory
Expand Down
16 changes: 10 additions & 6 deletions Content.Client/Movement/Systems/ContentEyeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@ public void RequestToggleFov()
public void RequestToggleFov(EntityUid uid, EyeComponent? eye = null)
{
if (Resolve(uid, ref eye, false))
RequestFov(!eye.DrawFov);
RequestEye(!eye.DrawFov, eye.DrawLight);
}

public void RequestFov(bool value)
public void RequestToggleLight(EntityUid uid, EyeComponent? eye = null)
{
RaisePredictiveEvent(new RequestFovEvent()
{
Fov = value,
});
if (Resolve(uid, ref eye, false))
RequestEye(eye.DrawFov, !eye.DrawLight);
}


public void RequestEye(bool drawFov, bool drawLight)
{
RaisePredictiveEvent(new RequestEyeEvent(drawFov, drawLight));
}
}
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</BoxContainer>
<CheckBox Name="ShowHeldItemCheckBox" Text="{Loc 'ui-options-show-held-item'}" />
<CheckBox Name="ShowCombatModeIndicatorsCheckBox" Text="{Loc 'ui-options-show-combat-mode-indicators'}" />
<CheckBox Name="ShowLoocAboveHeadCheckBox" Text="{Loc 'ui-options-show-looc-on-head'}" />
<BoxContainer Orientation="Horizontal">
<CheckBox Name="ViewportStretchCheckBox" Text="{Loc 'ui-options-vp-stretch'}" />
<BoxContainer Name="ViewportScaleBox" Orientation="Horizontal">
Expand Down
5 changes: 5 additions & 0 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public GraphicsTab()

ShowHeldItemCheckBox.OnToggled += OnCheckBoxToggled;
ShowCombatModeIndicatorsCheckBox.OnToggled += OnCheckBoxToggled;
ShowLoocAboveHeadCheckBox.OnToggled += OnCheckBoxToggled;
IntegerScalingCheckBox.OnToggled += OnCheckBoxToggled;
ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled;
ParallaxLowQualityCheckBox.OnToggled += OnCheckBoxToggled;
Expand All @@ -121,6 +122,7 @@ public GraphicsTab()
FpsCounterCheckBox.Pressed = _cfg.GetCVar(CCVars.HudFpsCounterVisible);
ShowHeldItemCheckBox.Pressed = _cfg.GetCVar(CCVars.HudHeldItemShow);
ShowCombatModeIndicatorsCheckBox.Pressed = _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
ShowLoocAboveHeadCheckBox.Pressed = _cfg.GetCVar(CCVars.LoocAboveHeadShow);
ViewportWidthSlider.Value = _cfg.GetCVar(CCVars.ViewportWidth);

_cfg.OnValueChanged(CCVars.ViewportMinimumWidth, _ => UpdateViewportWidthRange());
Expand Down Expand Up @@ -168,6 +170,7 @@ private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
_cfg.SetCVar(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox.Pressed);
_cfg.SetCVar(CCVars.HudHeldItemShow, ShowHeldItemCheckBox.Pressed);
_cfg.SetCVar(CCVars.CombatModeIndicatorsPointShow, ShowCombatModeIndicatorsCheckBox.Pressed);
_cfg.SetCVar(CCVars.LoocAboveHeadShow, ShowLoocAboveHeadCheckBox.Pressed);
_cfg.SetCVar(CCVars.HudFpsCounterVisible, FpsCounterCheckBox.Pressed);
_cfg.SetCVar(CCVars.ViewportWidth, (int) ViewportWidthSlider.Value);

Expand Down Expand Up @@ -205,6 +208,7 @@ private void UpdateApplyButton()
var isPLQSame = ParallaxLowQualityCheckBox.Pressed == _cfg.GetCVar(CCVars.ParallaxLowQuality);
var isShowHeldItemSame = ShowHeldItemCheckBox.Pressed == _cfg.GetCVar(CCVars.HudHeldItemShow);
var isCombatModeIndicatorsSame = ShowCombatModeIndicatorsCheckBox.Pressed == _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
var isLoocShowSame = ShowLoocAboveHeadCheckBox.Pressed == _cfg.GetCVar(CCVars.LoocAboveHeadShow);
var isFpsCounterVisibleSame = FpsCounterCheckBox.Pressed == _cfg.GetCVar(CCVars.HudFpsCounterVisible);
var isWidthSame = (int) ViewportWidthSlider.Value == _cfg.GetCVar(CCVars.ViewportWidth);
var isLayoutSame = HudLayoutOption.SelectedMetadata is string opt && opt == _cfg.GetCVar(CCVars.UILayout);
Expand All @@ -221,6 +225,7 @@ private void UpdateApplyButton()
isHudThemeSame &&
isShowHeldItemSame &&
isCombatModeIndicatorsSame &&
isLoocShowSame &&
isFpsCounterVisibleSame &&
isWidthSame &&
isLayoutSame;
Expand Down
Loading

0 comments on commit 37f5e17

Please sign in to comment.