Skip to content

Commit

Permalink
fixed line wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Legendaxe committed Jun 18, 2023
1 parent 34aafbc commit da14e78
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
20 changes: 14 additions & 6 deletions Content.Client/UserInterface/Systems/Chat/Widgets/ChatBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,24 @@ private void OnMessageAdded(ChatMessage msg)
? msg.MessageColorOverride.Value
: msg.Channel.TextColor();

if (_entityManager.HasComponent<GhostComponent>(_playerManager?.LocalPlayer?.ControlledEntity)
&& (msg.Channel & ChatChannel.IC) != ChatChannel.None
&& msg.SenderEntity != _playerManager?.LocalPlayer?.ControlledEntity)
var wrappedMessage = msg.WrappedMessage;
if (IsOrbit(msg.SenderEntity, msg.Channel))
{
msg.WrappedMessage += $"[cmdlink=\"({Loc.GetString("orbit-chat-click")})\" command=\"orbit {msg.SenderEntity}\"/]";
var orbitButtonText = Loc.GetString("orbit-chat-click");
wrappedMessage += $"\n[cmdlink=\"({orbitButtonText})\" command=\"orbit {msg.SenderEntity}\"][/cmdlink]";
}

AddLine(msg.WrappedMessage, color);
AddLine(wrappedMessage, color);
}

private bool IsOrbit(EntityUid senderEntity, ChatChannel channel)
{
return (_entityManager.HasComponent<GhostComponent>(_playerManager.LocalPlayer?.ControlledEntity)
&& (channel & (ChatChannel.IC ^ ChatChannel.Radio)) != ChatChannel.None
&& senderEntity != _playerManager.LocalPlayer?.ControlledEntity);
}


private void OnChannelSelect(ChatSelectChannel channel)
{
_controller.UpdateSelectedChannel(this);
Expand Down Expand Up @@ -113,7 +121,7 @@ private void OnChannelFilter(ChatChannel channel, bool active)

public void AddLine(string message, Color color)
{
var formatted = new FormattedMessage(3);
var formatted = new FormattedMessage(4);
formatted.PushColor(color);
formatted.AddMarkup(message);
formatted.Pop();
Expand Down
3 changes: 2 additions & 1 deletion Content.Server/SS220/Commands/OrbitCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt

using Content.Server.Ghost.Components;
using Content.Server.Mind.Components;
using Content.Shared.Administration;
using Content.Shared.Follower;
using Content.Shared.Follower.Components;
Expand Down Expand Up @@ -55,7 +56,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
return;
}

if (!_entityManager.HasComponent<FollowerComponent>(entityToFollow))
if (!_entityManager.HasComponent<MindComponent>(entityToFollow))
{
shell.WriteLine("You can't follow this entity");
return;
Expand Down
2 changes: 1 addition & 1 deletion Resources/Locale/ru-RU/ss220/orbit.ftl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
orbit-chat-click = Наблюдать
orbit-chat-click = Нажмите что бы наблюдать

0 comments on commit da14e78

Please sign in to comment.