Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nanochat lookup #2794

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

Toby222
Copy link

@Toby222 Toby222 commented Jan 24, 2025

About the PR

Adds a NanoChat number lookup to the NanoChat UI, listing numbers of other crew, and a quick-add button for new chats.
NanoChat numbers are listed by default for most PDAs, currently excluding Syndicate, CentComm, ERT, and CBURN.
Also looking for input and feedback on my implementation as this is my first time properly prodding at the codebase, and I feel like things could still be significantly improved. Largely using this as excuse to learn how to work in SS14 code :^)

Why / Balance

NanoChat appears to go chronically underutilized, at least partially because it requires exchanging numbers beforehand. For one-off communications (think: Couriers or Logi orders), it's not feasible and/or sensible to talk just for exchanging numbers.
This lookup is intended to make initiating communication easier.

Technical details

Program requires working Telecomms server on the station, and only shows Numbers of people on this station, wearing IDs with names, and who are set to be listed.
New chats created through this menu do not include a profession.
The "New Chat" button is greyed out for your own number, and for chats you already have created.

Media

Note that #0179's listing is turned off, and thus is not listed on any of the other PDAs. This updates in real time.
#1682 and #4124 have an open chat, their start chat buttons are thus greyed out on each other's list.
four PDA UIs, showing all states of the UI
PDA UI when there's no telecomms server accessible

Requirements

  • I have tested all added content and changes.
  • I have added media to this PR or it does not require an in-game showcase.

Breaking changes

Changelog
🆑

  • add: Add Number lookup to NanoChat

@github-actions github-actions bot added size/L 256-1023 lines Changes: YML Changes any yml files Changes: UI Changes: C# Changes any cs files Changes: Localization Changes any ftl files Changes: Sprite Changes any png or json in an rsi and removed size/L 256-1023 lines labels Jan 24, 2025
Copy link
Contributor

github-actions bot commented Jan 24, 2025

RSI Diff Bot; head commit 5ce1cac merging into 2324562
This PR makes changes to 1 or more RSIs. Here is a summary of all changes:

Resources/Textures/_DV/Misc/program_icons.rsi

State Old New Status
nanophonebook Added

Resources/Textures/_DV/Objects/Devices/cartridge.rsi

State Old New Status
cart-lookup Added

Edit: diff updated after 5ce1cac

@github-actions github-actions bot added the size/L 256-1023 lines label Jan 25, 2025
@Toby222 Toby222 marked this pull request as ready for review January 25, 2025 00:35
@Toby222 Toby222 requested review from a team as code owners January 25, 2025 00:35
@honeyed-lemons
Copy link

Personally, and this is just me, but I feel this would be better implemented as a tab in the nanochat app. Maybe have the ability to hide your ID to non command. But thats my opinion and this looks great anyways, xaml warrior o7

@Toby222
Copy link
Author

Toby222 commented Jan 25, 2025

Personally, and this is just me, but I feel this would be better implemented as a tab in the nanochat app. Maybe have the ability to hide your ID to non command. But thats my opinion and this looks great anyways, xaml warrior o7

I did consider that, but didn't know how to match that with my thought that not everyone should have access to the Number lookup. (This whole thing was brought on by me playing Courier/Logi and being annoyed at people not responding on Common and me not knowing their PDA)

@honeyed-lemons
Copy link

I think everyone having access works fine if you can turn off your number for the general public, Imo

@Toby222
Copy link
Author

Toby222 commented Jan 25, 2025

This is true.
Could also add a second setting to the settings menu for that then :^)

@Toby222 Toby222 requested a review from deltanedas January 25, 2025 02:03
@sleepyyapril
Copy link
Contributor

This is true. Could also add a second setting to the settings menu for that then :^)

Add it as a button in the Lookup app

@ThataKat
Copy link
Contributor

I think you could probably get away with just having it private by default and if people want to reveal their numbers they can.

@Toby222
Copy link
Author

Toby222 commented Jan 25, 2025

I think you could probably get away with just having it private by default and if people want to reveal their numbers they can.

That'd end up causing the exact problem I'm trying to avoid, where people's NanoChat is inaccessible unless they share it first.
I'm adding a property to the NanoChatCardComponent that's set to true for most people except antagonist roles
Also seeing how merging the UI into NanoChat itself works

@ThataKat
Copy link
Contributor

I'll wait on popping this over to direction until it's finalized (should be a quick review anyways)

@Toby222
Copy link
Author

Toby222 commented Jan 25, 2025

Yea I'm reworking it to be a tab inside NanoChat instead of a separate cartridge as previously recommended, so I appreciate it :^)

@Toby222 Toby222 marked this pull request as draft January 25, 2025 19:17
@Toby222 Toby222 marked this pull request as ready for review January 25, 2025 19:29
@Toby222
Copy link
Author

Toby222 commented Jan 25, 2025

I've reworked the whole UX now, seems to work pretty nicely

@deltanedas
Copy link
Member

please do not have it automated by antag roles that will lead to people going through the manifest and seeing whos not there then arresting for being a thief

Comment on lines 244 to 286
var nameLabel = new Label()
{
Text = contact.Name,
HorizontalAlignment = HAlignment.Left,
HorizontalExpand = true
};
var numberLabel = new Label()
{
Text = $"#{contacts[idx].Number:D4}",
HorizontalAlignment = HAlignment.Right,
Margin = new Thickness(0, 0, 36, 0),
};
var startChatButton = new Button()
{
Text = "+",
HorizontalAlignment = HAlignment.Right,
MinSize = new Vector2(32, 32),
MaxSize = new Vector2(32, 32),
ToolTip = Loc.GetString("nano-chat-new-chat"),
};
startChatButton.AddStyleClass("OpenBoth");
if (contact.Number == _ownNumber || _recipients.ContainsKey(contact.Number))
{
startChatButton.Disabled = true;
}
startChatButton.OnPressed += _ =>
{
if (OnMessageSent is { } handler)
{
handler(NanoChatUiMessageType.NewChat, contact.Number, contact.Name, contact.JobTitle);
SelectChat(contact.Number);
ToggleView();
}
};

var panel = new PanelContainer()
{
HorizontalExpand = true,
};

panel.AddChild(nameLabel);
panel.AddChild(numberLabel);
panel.AddChild(startChatButton);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this into a separate control using xaml

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Can you confirm/deny that this is approximately what you expected?
The normal view still in the same place, and just the LookupView separated into its own Container?

Content.Server/PDA/PdaSystem.cs Outdated Show resolved Hide resolved
Content.Server/PDA/PdaSystem.cs Outdated Show resolved Hide resolved
Content.Server/PDA/PdaSystem.cs Outdated Show resolved Hide resolved
Content.Shared/PDA/PdaUpdateState.cs Outdated Show resolved Hide resolved
Content.Shared/PDA/PdaUpdateState.cs Outdated Show resolved Hide resolved
Content.Shared/PDA/PdaUpdateState.cs Outdated Show resolved Hide resolved
@github-actions github-actions bot added size/M 64-255 lines and removed size/L 256-1023 lines labels Jan 25, 2025
@Toby222
Copy link
Author

Toby222 commented Jan 25, 2025

please do not have it automated by antag roles that will lead to people going through the manifest and seeing whos not there then arresting for being a thief

I was trying to only set it based on antags that shouldn't be on the station; I've got next to no experience actually interacting with syndies and the like, so I presumed all of the ones I tagged work like Nukies which aren't supposed to be on the station and presumably don't show up on the manifest.

@github-actions github-actions bot added size/L 256-1023 lines and removed size/M 64-255 lines labels Jan 25, 2025
@Toby222 Toby222 requested a review from deltanedas January 25, 2025 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes: C# Changes any cs files Changes: Localization Changes any ftl files Changes: Sprite Changes any png or json in an rsi Changes: UI Changes: YML Changes any yml files S: Needs Review size/L 256-1023 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants