Clean up Funky commments in _DV
This commit is contained in:
parent
08ecb92fdc
commit
188e895d6a
|
|
@ -26,7 +26,7 @@
|
|||
</PanelContainer.PanelOverride>
|
||||
</PanelContainer>
|
||||
|
||||
<!-- Funky Station - Group chat icon -->
|
||||
<!-- Group chat icon -->
|
||||
<TextureRect Name="GroupIcon"
|
||||
TexturePath="/Textures/_Funkystation/Interface/NanoChat/members.png"
|
||||
MinSize="16 16"
|
||||
|
|
|
|||
|
|
@ -44,8 +44,6 @@ public sealed partial class NanoChatEntry : BoxContainer
|
|||
JobLabel.Text = FormattedMessage.EscapeText(SharedNanoChatSystem.Truncate(recipient.JobTitle ?? string.Empty, _maxIdJobLength));
|
||||
JobLabel.Visible = !string.IsNullOrWhiteSpace(JobLabel.Text);
|
||||
UnreadIndicator.Visible = recipient.HasUnread;
|
||||
|
||||
// Funky Station - Show group icon for group chats
|
||||
GroupIcon.Visible = recipient.IsGroup;
|
||||
|
||||
ChatButton.ModulateSelfOverride = isSelected ? NanoChatMessageBubble.OwnMessageColor : null;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Content.Client._DV.CartridgeLoader.Cartridges;
|
|||
[GenerateTypedNameReferences]
|
||||
public sealed partial class NanoChatMessageBubble : BoxContainer
|
||||
{
|
||||
private static readonly Regex EmojiRegex = new(@":(\w+):", RegexOptions.Compiled); // Funky Station - Emoji Parsing
|
||||
private static readonly Regex EmojiRegex = new(@":(\w+):", RegexOptions.Compiled);
|
||||
|
||||
public static readonly Color OwnMessageColor = Color.FromHex("#173717d9"); // Dark green
|
||||
public static readonly Color OtherMessageColor = Color.FromHex("#252525d9"); // Dark gray
|
||||
|
|
@ -25,7 +25,6 @@ public sealed partial class NanoChatMessageBubble : BoxContainer
|
|||
RobustXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
// Funky Station - Added senderName and showSenderName parameters
|
||||
public void SetMessage(NanoChatMessage message, bool isOwnMessage, string? senderName = null, bool showSenderName = false)
|
||||
{
|
||||
if (MessagePanel.PanelOverride is not StyleBoxFlat)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using Robust.Client.UserInterface;
|
|||
|
||||
namespace Content.Client._DV.CartridgeLoader.Cartridges;
|
||||
|
||||
public sealed partial class NanoChatUi : UIFragment, IDisposable // Funky: Disposable to clean popups
|
||||
public sealed partial class NanoChatUi : UIFragment, IDisposable
|
||||
{
|
||||
private NanoChatUiFragment? _fragment;
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ public sealed partial class NanoChatUi : UIFragment, IDisposable // Funky: Dispo
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
// Funky: Close all popups when switching apps or closing the PDA
|
||||
// Close all popups when switching apps or closing the PDA
|
||||
_fragment?.CloseAllPopups();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@
|
|||
Margin="0 0 4 0"
|
||||
StyleClasses="OpenBoth"
|
||||
ToolTip="{Loc nano-chat-new-chat}" />
|
||||
<!-- Funky Station - Group Chats -->
|
||||
<Button Name="CreateGroupChatButton"
|
||||
MinSize="32 32"
|
||||
MaxSize="32 32"
|
||||
|
|
@ -209,7 +208,6 @@
|
|||
MinSize="18 18" />
|
||||
</Control>
|
||||
</Button>
|
||||
<!-- Funky Station - Group Chats (Invite button) -->
|
||||
<Button Name="InviteToGroupButton"
|
||||
MaxSize="32 32"
|
||||
Visible="False"
|
||||
|
|
@ -221,7 +219,6 @@
|
|||
Stretch="KeepAspectCentered"
|
||||
MinSize="18 18" />
|
||||
</Button>
|
||||
<!-- Funky Station - Group Chats (Member List button) -->
|
||||
<Button Name="ViewMembersButton"
|
||||
MaxSize="32 32"
|
||||
Visible="False"
|
||||
|
|
@ -238,7 +235,7 @@
|
|||
PlaceHolder="{Loc nano-chat-message-placeholder}"
|
||||
HorizontalExpand="True"
|
||||
StyleClasses="OpenRight" />
|
||||
<!-- Funky Station - Emoji Picker -->
|
||||
<!-- Emoji Picker -->
|
||||
<Button Name="EmojiButton"
|
||||
MinSize="32 32"
|
||||
MaxSize="32 32"
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
|
||||
private int _maxNameLength;
|
||||
private int _maxIdJobLength;
|
||||
private readonly int _maxNameLength;
|
||||
private readonly int _maxIdJobLength;
|
||||
private readonly NewChatPopup _newChatPopup;
|
||||
private readonly EditChatPopup _editChatPopup;
|
||||
private readonly CreateGroupChatPopup _createGroupChatPopup; // Funky Station - Create Group Chat Popup
|
||||
private readonly InviteToGroupPopup _inviteToGroupPopup; // Funky Station - Group Chat Invite Popup
|
||||
private readonly GroupMembersPopup _groupMembersPopup; // Funky Station - Group Chat Members Popup
|
||||
private readonly EmojiPickerPopup _emojiPickerPopup; // Funky Station - Emoji Picker
|
||||
private readonly CreateGroupChatPopup _createGroupChatPopup;
|
||||
private readonly InviteToGroupPopup _inviteToGroupPopup;
|
||||
private readonly GroupMembersPopup _groupMembersPopup;
|
||||
private readonly EmojiPickerPopup _emojiPickerPopup;
|
||||
private uint? _currentChat;
|
||||
private uint? _pendingChat;
|
||||
private uint _ownNumber;
|
||||
|
|
@ -45,7 +45,7 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
private Dictionary<uint, NanoChatRecipient> _recipients = [];
|
||||
private Dictionary<uint, List<NanoChatMessage>> _messages = [];
|
||||
private HashSet<uint> _mutedChats = [];
|
||||
private List<NanoChatRecipient>? _contacts; // Funky Station - Used in order to show names for people not in recipients
|
||||
private List<NanoChatRecipient>? _contacts; // Used in order to show names for people not in recipients
|
||||
|
||||
public event Action<NanoChatUiMessageType, uint?, string?, string?>? OnMessageSent;
|
||||
|
||||
|
|
@ -78,7 +78,6 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
OnMessageSent?.Invoke(NanoChatUiMessageType.EditChat, number, name, job);
|
||||
};
|
||||
|
||||
// Funky Station Start - Group Chat Handlers
|
||||
_createGroupChatPopup.OnGroupCreated += (name) =>
|
||||
{
|
||||
OnMessageSent?.Invoke(NanoChatUiMessageType.CreateGroupChat, null, name, null);
|
||||
|
|
@ -116,9 +115,7 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
OnMessageSent?.Invoke(NanoChatUiMessageType.DeadminUser, currentChat, number.ToString(), null);
|
||||
};
|
||||
|
||||
// Funky Station End - Group Chat Handlers
|
||||
|
||||
_emojiPickerPopup.OnEmojiSelected += InsertEmoji; // Funky Station - Emoji Picker
|
||||
_emojiPickerPopup.OnEmojiSelected += InsertEmoji;
|
||||
|
||||
NewChatButton.OnPressed += _ =>
|
||||
{
|
||||
|
|
@ -126,7 +123,6 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
_newChatPopup.OpenCentered();
|
||||
};
|
||||
|
||||
// Funky Station - Create Group Chat Button
|
||||
CreateGroupChatButton.OnPressed += _ =>
|
||||
{
|
||||
_createGroupChatPopup.ClearInputs();
|
||||
|
|
@ -203,14 +199,13 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
|
||||
MessageInput.OnTextEntered += _ => SendMessage();
|
||||
SendButton.OnPressed += _ => SendMessage();
|
||||
EmojiButton.OnPressed += _ => OpenEmojiPicker(); // Funky Station - Emoji Picker
|
||||
EmojiButton.OnPressed += _ => OpenEmojiPicker();
|
||||
EditChatButton.OnPressed += _ => BeginEditChat();
|
||||
DeleteChatButton.OnPressed += _ => DeleteCurrentChat();
|
||||
InviteToGroupButton.OnPressed += _ => OpenInvitePopup(); // Funky Station - Group Chat Invite Popup
|
||||
ViewMembersButton.OnPressed += _ => OpenMembersPopup(); // Funky Station - Group Chat Members Popup
|
||||
InviteToGroupButton.OnPressed += _ => OpenInvitePopup();
|
||||
ViewMembersButton.OnPressed += _ => OpenMembersPopup();
|
||||
}
|
||||
|
||||
// Funky Station Start - Emoji Picker
|
||||
private void OpenEmojiPicker()
|
||||
{
|
||||
// Close any existing emoji picker to prevent duplicates (shouldn't be happening anyway but it sure did)
|
||||
|
|
@ -230,33 +225,19 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
MessageInput.CursorPosition = cursorPos + emoji.Length;
|
||||
MessageInput.GrabKeyboardFocus();
|
||||
}
|
||||
// Funky Station End - Emoji Picker
|
||||
|
||||
// Funky Station Start - Clear Popups
|
||||
/// <summary>
|
||||
/// Closes all open popups. Called when switching apps or closing the PDA.
|
||||
/// </summary>
|
||||
public void CloseAllPopups()
|
||||
{
|
||||
if (_emojiPickerPopup.IsOpen)
|
||||
_emojiPickerPopup.Close();
|
||||
|
||||
if (_inviteToGroupPopup.IsOpen)
|
||||
_inviteToGroupPopup.Close();
|
||||
|
||||
if (_groupMembersPopup.IsOpen)
|
||||
_groupMembersPopup.Close();
|
||||
|
||||
if (_newChatPopup.IsOpen)
|
||||
_newChatPopup.Close();
|
||||
|
||||
if (_editChatPopup.IsOpen)
|
||||
_editChatPopup.Close();
|
||||
|
||||
if (_createGroupChatPopup.IsOpen)
|
||||
_createGroupChatPopup.Close();
|
||||
_emojiPickerPopup.Close();
|
||||
_inviteToGroupPopup.Close();
|
||||
_groupMembersPopup.Close();
|
||||
_newChatPopup.Close();
|
||||
_editChatPopup.Close();
|
||||
_createGroupChatPopup.Close();
|
||||
}
|
||||
// Funky Station End - Clear Popups
|
||||
|
||||
private void ToggleView()
|
||||
{
|
||||
|
|
@ -372,7 +353,6 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
OnMessageSent?.Invoke(NanoChatUiMessageType.DeleteChat, activeChat, null, null);
|
||||
}
|
||||
|
||||
// Funky Station Start - Group Chat Popups
|
||||
private void OpenInvitePopup()
|
||||
{
|
||||
if (_currentChat is not uint currentChat ||
|
||||
|
|
@ -455,7 +435,6 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
}
|
||||
}
|
||||
}
|
||||
// Funky Station End - Group Chat Popups
|
||||
|
||||
private void BeginEditChat()
|
||||
{
|
||||
|
|
@ -499,7 +478,6 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
var activeChat = _pendingChat ?? _currentChat;
|
||||
var hasActiveChat = activeChat != null;
|
||||
|
||||
// Funky Station Start - Group Chats
|
||||
var isGroupChat = false;
|
||||
var canManageGroup = false;
|
||||
NanoChatRecipient recipient = default;
|
||||
|
|
@ -511,23 +489,22 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
isGroupChat = recipient.IsGroup;
|
||||
canManageGroup = isGroupChat && (recipient.CreatorId == _ownNumber || recipient.Admins?.Contains(_ownNumber) == true);
|
||||
}
|
||||
// Funky Station End - Group Chats
|
||||
|
||||
// Update UI state
|
||||
MessagesScroll.Visible = hasActiveChat;
|
||||
CurrentChatName.Visible = !hasActiveChat;
|
||||
MessageInputContainer.Visible = hasActiveChat;
|
||||
DeleteChatButton.Visible = hasActiveChat;
|
||||
EditChatButton.Visible = hasActiveChat && !isGroupChat; // Funky Station - Edit chat button only available for non-group chats
|
||||
EditChatButton.Visible = hasActiveChat && !isGroupChat;
|
||||
DeleteChatButton.Disabled = !hasActiveChat;
|
||||
|
||||
|
||||
InviteToGroupButton.Visible = canManageGroup; // Funky Station - Show invite button only if can manage
|
||||
ViewMembersButton.Visible = isGroupChat; // Funky Station - Show members button for group chats
|
||||
InviteToGroupButton.Visible = canManageGroup;
|
||||
ViewMembersButton.Visible = isGroupChat;
|
||||
|
||||
if (hasRecipient) // Funky Station - Changed this so we don't have to TryGetValue twice.
|
||||
if (hasRecipient)
|
||||
{
|
||||
if (isGroupChat) // Funky Station - Group chats don't need job titles
|
||||
if (isGroupChat)
|
||||
{
|
||||
CurrentChatName.Text = recipient.Name;
|
||||
}
|
||||
|
|
@ -551,11 +528,9 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
if (activeChat == null || !messages.TryGetValue(activeChat.Value, out var chatMessages))
|
||||
return;
|
||||
|
||||
var isGroupChat = _recipients.TryGetValue(activeChat.Value, out var recipient) && recipient.IsGroup; // Funky Station - Group Chats
|
||||
|
||||
var isGroupChat = _recipients.TryGetValue(activeChat.Value, out var recipient) && recipient.IsGroup;
|
||||
foreach (var message in chatMessages)
|
||||
{
|
||||
// Funky Station Start - Added sender name for group chats
|
||||
var messageBubble = new NanoChatMessageBubble();
|
||||
var isOwnMessage = message.SenderId == _ownNumber;
|
||||
|
||||
|
|
@ -563,7 +538,7 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
string? senderName = null;
|
||||
if (isGroupChat && !isOwnMessage)
|
||||
{
|
||||
// Funky Station - Try to get sender name from contacts first, then recipients
|
||||
// Try to get sender name from contacts first, then recipients
|
||||
if (_recipients.TryGetValue(message.SenderId, out var senderRecipient))
|
||||
{
|
||||
senderName = senderRecipient.Name;
|
||||
|
|
@ -580,12 +555,11 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
// Fallback to "Unknown" with number if name not found
|
||||
if (senderName == null)
|
||||
{
|
||||
senderName = $"{Loc.GetString("nano-chat-unknown-sender")}#{message.SenderId:D4}"; // Funky Station
|
||||
senderName = $"{Loc.GetString("nano-chat-unknown-sender")}#{message.SenderId:D4}";
|
||||
}
|
||||
}
|
||||
|
||||
messageBubble.SetMessage(message, isOwnMessage, senderName, isGroupChat && !isOwnMessage);
|
||||
// Funky Station End - Added sender name for group chats
|
||||
|
||||
MessageList.AddChild(messageBubble);
|
||||
|
||||
|
|
@ -625,7 +599,7 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
_notificationsMuted = state.NotificationsMuted;
|
||||
_listNumber = state.ListNumber;
|
||||
_mutedChats = state.MutedChats;
|
||||
_contacts = state.Contacts; // Funky Station - Used in order to show names for people not in recipients
|
||||
_contacts = state.Contacts;
|
||||
OwnNumberLabel.Text = $"#{state.OwnNumber:D4}";
|
||||
UpdateMuteButton();
|
||||
UpdateListNumber();
|
||||
|
|
@ -650,14 +624,13 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
if (_pendingChat == null)
|
||||
_currentChat = state.CurrentChat;
|
||||
|
||||
// Funky Station - Update recipients first, then update UI that depends on it
|
||||
// Update recipients first, then update UI that depends on it
|
||||
UpdateChatList(state.Recipients);
|
||||
UpdateMessages(state.Messages);
|
||||
UpdateCurrentChat();
|
||||
UpdateMuteChatButton();
|
||||
LookupView.UpdateContactList(state);
|
||||
|
||||
// Funky Station - Refresh any open popups
|
||||
RefreshOpenPopups();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
case NanoChatUiMessageType.ToggleListNumber:
|
||||
HandleToggleListNumber(card);
|
||||
break;
|
||||
// Funky Station Start - Group Chat Functionality
|
||||
case NanoChatUiMessageType.CreateGroupChat:
|
||||
HandleCreateGroupChat(card, msg);
|
||||
break;
|
||||
|
|
@ -154,7 +153,6 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
case NanoChatUiMessageType.DeadminUser:
|
||||
HandleDeadminUser(card, msg);
|
||||
break;
|
||||
// Funky Station End - Group Chat Functionality
|
||||
}
|
||||
|
||||
UpdateUI(ent, GetEntity(args.LoaderUid));
|
||||
|
|
@ -302,7 +300,6 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
if (msg.RecipientNumber == null || card.Comp.Number == null)
|
||||
return;
|
||||
|
||||
// Funky Station Start - Group Chat Handling
|
||||
var chatNumber = msg.RecipientNumber.Value;
|
||||
var recipient = _nanoChat.GetRecipient((card, card.Comp), chatNumber);
|
||||
|
||||
|
|
@ -352,17 +349,16 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
}
|
||||
}
|
||||
}
|
||||
// Funky Station End - Group Chat Handling
|
||||
|
||||
// Delete chat but keep the messages
|
||||
var deleted = _nanoChat.TryDeleteChat((card, card.Comp), chatNumber, true); // Funky Station - Stored chatNumber earlier so we don't have to get it multiple times.
|
||||
var deleted = _nanoChat.TryDeleteChat((card, card.Comp), chatNumber, true);
|
||||
|
||||
if (!deleted)
|
||||
return;
|
||||
|
||||
_adminLogger.Add(LogType.Action,
|
||||
LogImpact.Low,
|
||||
$"{ToPrettyString(msg.Actor):user} deleted NanoChat conversation with #{chatNumber:D4}"); // Funky Station - Used stored chatNumber.
|
||||
$"{ToPrettyString(msg.Actor):user} deleted NanoChat conversation with #{chatNumber:D4}");
|
||||
|
||||
UpdateUIForCard(card);
|
||||
}
|
||||
|
|
@ -400,14 +396,12 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
if (msg.RecipientNumber == null || msg.Content == null || card.Comp.Number == null)
|
||||
return;
|
||||
|
||||
// Funky Station Begin - Group Chats (Check if this is a group chat before trying to ensure recipient exists)
|
||||
var recipient = _nanoChat.GetRecipient((card, card.Comp), msg.RecipientNumber.Value);
|
||||
var isGroupChat = recipient?.IsGroup ?? false;
|
||||
|
||||
// Only ensure recipient exists for non-group chats
|
||||
if (!isGroupChat && !EnsureRecipientExists(card, msg.RecipientNumber.Value))
|
||||
return;
|
||||
// Funky Station End - Group Chats
|
||||
|
||||
var content = msg.Content;
|
||||
if (!string.IsNullOrWhiteSpace(content))
|
||||
|
|
@ -424,7 +418,6 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
(uint)card.Comp.Number
|
||||
);
|
||||
|
||||
// Funky Station Start - Group Chat Handling
|
||||
List<Entity<NanoChatCardComponent>> recipients;
|
||||
bool deliveryFailed;
|
||||
|
||||
|
|
@ -438,7 +431,6 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
// For regular chats, deliver to single recipient
|
||||
(deliveryFailed, recipients) = AttemptMessageDelivery(cartridge, msg.RecipientNumber.Value);
|
||||
}
|
||||
// Funky Station End - Group Chat Handling
|
||||
|
||||
// Update delivery status
|
||||
message = message with { DeliveryFailed = deliveryFailed };
|
||||
|
|
@ -463,7 +455,7 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
|
||||
foreach (var recipientCard in recipients)
|
||||
{
|
||||
DeliverMessageToRecipient(card, recipientCard, message, msg.RecipientNumber.Value, recipient); // Funky Station - Modified for Group Chats.
|
||||
DeliverMessageToRecipient(card, recipientCard, message, msg.RecipientNumber.Value, recipient);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -570,8 +562,6 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
return false;
|
||||
}
|
||||
|
||||
// Funky Station Start - Heavily modified to support group chats
|
||||
|
||||
/// <summary>
|
||||
/// Delivers a message to the recipient and handles associated notifications.
|
||||
/// </summary>
|
||||
|
|
@ -632,8 +622,6 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
RaiseLocalEvent(ref msgEv);
|
||||
UpdateUIForCard(recipient);
|
||||
}
|
||||
// Funky Station End - Heavily modified to support group chats
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to deliver a message to all members of a group chat.
|
||||
|
|
@ -641,7 +629,7 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
private (bool failed, List<Entity<NanoChatCardComponent>> recipients) AttemptGroupMessageDelivery(
|
||||
Entity<NanoChatCartridgeComponent> sender,
|
||||
NanoChatRecipient groupRecipient,
|
||||
uint senderNumber) // Funky Station - Group Chats
|
||||
uint senderNumber)
|
||||
{
|
||||
if (groupRecipient.Members == null)
|
||||
return (true, new List<Entity<NanoChatCardComponent>>());
|
||||
|
|
@ -673,19 +661,19 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
var recipients = _nanoChat.GetRecipients((recipient, recipient.Comp));
|
||||
var senderName = recipients.TryGetValue(senderNumber, out var senderRecipient)
|
||||
? senderRecipient.Name
|
||||
: $"#{senderNumber:D4}"; // Funky Station - senderNumber is used now in order to support group chats.
|
||||
: $"#{senderNumber:D4}";
|
||||
var hasSelectedCurrentChat = _nanoChat.GetCurrentChat((recipient, recipient.Comp)) == senderNumber;
|
||||
|
||||
// Update unread status
|
||||
if (!hasSelectedCurrentChat)
|
||||
_nanoChat.SetRecipient((recipient, recipient.Comp),
|
||||
senderNumber, // Funky Station - senderNumber is used now in order to support group chats.
|
||||
senderNumber,
|
||||
senderRecipient with { HasUnread = true });
|
||||
|
||||
// Temporary local to avoid trouble with read-only access; Contains doesn't modify the collection
|
||||
HashSet<uint> mutedChats = recipient.Comp.MutedChats;
|
||||
if (recipient.Comp.NotificationsMuted ||
|
||||
mutedChats.Contains(senderNumber) || // Funky Station - senderNumber is used now in order to support group chats.
|
||||
mutedChats.Contains(senderNumber) ||
|
||||
recipient.Comp.PdaUid is not { } pdaUid ||
|
||||
!TryComp<CartridgeLoaderComponent>(pdaUid, out var loader) ||
|
||||
// Don't notify if the recipient has the NanoChat program open with this chat selected.
|
||||
|
|
@ -754,16 +742,14 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
|
||||
// Try to get job title from ID card if possible
|
||||
string? jobTitle = null;
|
||||
string? department = null; // Funky Station - Department Sorting
|
||||
string? department = null;
|
||||
var name = "Unknown";
|
||||
if (TryComp<IdCardComponent>(uid, out var idCard))
|
||||
{
|
||||
jobTitle = idCard.LocalizedJobTitle;
|
||||
name = idCard.FullName ?? name;
|
||||
// Funky Station Start - Department Sorting: Get primary department
|
||||
if (idCard.JobDepartments is { } depts && depts.Count > 0)
|
||||
department = depts[0].ToString();
|
||||
// Funky Station End - Department Sorting
|
||||
}
|
||||
|
||||
return new NanoChatRecipient(
|
||||
|
|
@ -802,7 +788,6 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
{
|
||||
if (nanoChatCard.ListNumber && nanoChatCard.Number is uint nanoChatNumber && idCardComponent.FullName is string fullName && _station.GetOwningStation(entityId) == station)
|
||||
{
|
||||
// Funky Station Start - Department Sorting: Include department and job title in contacts
|
||||
var jobTitle = idCardComponent.LocalizedJobTitle;
|
||||
string? department = null;
|
||||
if (idCardComponent.JobDepartments is { } depts && depts.Count > 0)
|
||||
|
|
@ -863,7 +848,7 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
/// <summary>
|
||||
/// Handles creation of a new group chat.
|
||||
/// </summary>
|
||||
private void HandleCreateGroupChat(Entity<NanoChatCardComponent> card, NanoChatUiMessageEvent msg) // Funky Station - Group Chats
|
||||
private void HandleCreateGroupChat(Entity<NanoChatCardComponent> card, NanoChatUiMessageEvent msg)
|
||||
{
|
||||
if (msg.Content == null || card.Comp.Number == null)
|
||||
return;
|
||||
|
|
@ -912,7 +897,7 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
/// <summary>
|
||||
/// Handles inviting a user to a group chat.
|
||||
/// </summary>
|
||||
private void HandleInviteToGroup(Entity<NanoChatCardComponent> card, NanoChatUiMessageEvent msg) // Funky Station - Group Chats
|
||||
private void HandleInviteToGroup(Entity<NanoChatCardComponent> card, NanoChatUiMessageEvent msg)
|
||||
{
|
||||
if (msg.RecipientNumber == null || msg.Content == null || card.Comp.Number == null)
|
||||
return;
|
||||
|
|
@ -971,7 +956,7 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
/// <summary>
|
||||
/// Handles kicking a user from a group chat.
|
||||
/// </summary>
|
||||
private void HandleKickFromGroup(Entity<NanoChatCardComponent> card, NanoChatUiMessageEvent msg) // Funky Station - Group Chats
|
||||
private void HandleKickFromGroup(Entity<NanoChatCardComponent> card, NanoChatUiMessageEvent msg)
|
||||
{
|
||||
if (msg.RecipientNumber == null || msg.Content == null || card.Comp.Number == null)
|
||||
return;
|
||||
|
|
@ -1038,7 +1023,7 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
/// <summary>
|
||||
/// Handles promoting a user to admin in a group chat.
|
||||
/// </summary>
|
||||
private void HandleAdminUser(Entity<NanoChatCardComponent> card, NanoChatUiMessageEvent msg) // Funky Station - Group Chats
|
||||
private void HandleAdminUser(Entity<NanoChatCardComponent> card, NanoChatUiMessageEvent msg)
|
||||
{
|
||||
if (msg.RecipientNumber == null || msg.Content == null || card.Comp.Number == null)
|
||||
return;
|
||||
|
|
@ -1107,7 +1092,7 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
|
|||
/// <summary>
|
||||
/// Handles demoting a user from admin in a group chat.
|
||||
/// </summary>
|
||||
private void HandleDeadminUser(Entity<NanoChatCardComponent> card, NanoChatUiMessageEvent msg) // Funky Station - Group Chats
|
||||
private void HandleDeadminUser(Entity<NanoChatCardComponent> card, NanoChatUiMessageEvent msg)
|
||||
{
|
||||
if (msg.RecipientNumber == null || msg.Content == null || card.Comp.Number == null)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -58,12 +58,12 @@ public enum NanoChatUiMessageType : byte
|
|||
ToggleMute,
|
||||
ToggleMuteChat,
|
||||
ToggleListNumber,
|
||||
CreateGroupChat, // Funky Station - Group Chats
|
||||
InviteToGroup, // Funky Station - Group Chats
|
||||
KickFromGroup, // Funky Station - Group Chats
|
||||
ViewGroupMembers, // Funky Station - Group Chats
|
||||
AdminUser, // Funky Station - Group Chats
|
||||
DeadminUser, // Funky Station - Group Chats
|
||||
CreateGroupChat,
|
||||
InviteToGroup,
|
||||
KickFromGroup,
|
||||
ViewGroupMembers,
|
||||
AdminUser,
|
||||
DeadminUser,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -73,7 +73,7 @@ public enum NanoChatUiMessageType : byte
|
|||
/// <param name="number">The recipient's NanoChat number</param>
|
||||
/// <param name="name">The recipient's display name</param>
|
||||
/// <param name="jobTitle">Optional job title for the recipient</param>
|
||||
/// <param name="department">Optional department ID for the recipient</param> // Funky Station - Department Sorting
|
||||
/// <param name="department">Optional department ID for the recipient</param>
|
||||
/// <param name="hasUnread">Whether there are unread messages from this recipient</param>
|
||||
/// <param name="isGroup">Whether this is a group chat</param>
|
||||
/// <param name="members">For group chats: list of member NanoChat numbers</param>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public abstract class SharedNanoChatSystem : EntitySystem
|
|||
/// <summary>
|
||||
/// Helper Method for truncating a string to maximum length
|
||||
/// </summary>
|
||||
public static string Truncate(string? text, int maxLength, string overflowText = "...") // Funky station - made text nullable because weird shit was happening that I could not bother to debug.
|
||||
public static string Truncate(string text, int maxLength, string overflowText = "...")
|
||||
{
|
||||
if (string.IsNullOrEmpty(text))
|
||||
return string.Empty;
|
||||
|
|
|
|||
Loading…
Reference in New Issue