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

Fuck You #44

Closed
wants to merge 113 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
d8ae58e
Station AI (#30944)
metalgearsloth Aug 28, 2024
c866ffb
Verb tweaks (#31309)
metalgearsloth Aug 25, 2024
d6b0b99
ItemToggle + slots stuff (#31312)
metalgearsloth Aug 25, 2024
56451fa
Station AI (#30944)
ElectroJr Jun 18, 2024
bdafdeb
Move SleepingSystem to Shared & cleanup (#28672)
Tayrtahn Jun 14, 2024
ede16f0
Potentially re-add EE changes?
sleepyyapril Jan 4, 2025
661bdba
Fix build errors
sleepyyapril Jan 4, 2025
006acf3
Add ContainerComp (#31311)
metalgearsloth Aug 25, 2024
b7e34aa
Localize ai dataset names (#33608)
MilenVolf Dec 6, 2024
b8e2844
Add LocalizedDatasetPrototype (#28310)
Tayrtahn May 28, 2024
c9e0e5d
SetStationAiName for testing
sleepyyapril Jan 4, 2025
0334cc6
Use EntityManager.System<>
sleepyyapril Jan 4, 2025
00adaa3
Re-add improved random sentience event (#29123)
Psychpsyo Aug 18, 2024
b262e8f
no name!
Psychpsyo Sep 8, 2024
385b667
fix shitcode
sleepyyapril Jan 4, 2025
f5e6583
HideSpawnMenu
sleepyyapril Jan 4, 2025
1b7d820
Merge branch 'master' into station-ai
sleepyyapril Jan 4, 2025
1ad367b
Yippee
sleepyyapril Jan 4, 2025
1f416da
Merge branch 'station-ai' of https://github.com/sleepyyapril/Einstein…
sleepyyapril Jan 4, 2025
ca0b40a
The Den Mass Cherry-Pick 01/06/25 (#1443)
angelofallars Jan 5, 2025
975c905
Automatic Changelog Update (#1443)
SimpleStation14 Jan 5, 2025
632cf60
Merge branch 'master' into station-ai
VMSolidus Jan 5, 2025
760596d
Fix Humanoid Color (#1454)
Spatison Jan 7, 2025
f6dec10
Automatic Changelog Update (#1454)
SimpleStation14 Jan 7, 2025
990a57c
Make Non-Verbal Langs Not Play Speech (#1448)
RadsammyT Jan 7, 2025
5353363
Automatic Changelog Update (#1448)
SimpleStation14 Jan 7, 2025
a05bbce
[Port] Add Time Transfer Panel From Goobstation (#1429)
CerberusWolfie Jan 7, 2025
bac302c
Automatic Changelog Update (#1429)
SimpleStation14 Jan 7, 2025
f026528
Fix Toolshed Crash (#1415)
sleepyyapril Jan 7, 2025
f11d2e7
NanoChat QoL And Bug Fixes (#1460)
angelofallars Jan 8, 2025
747cb50
Automatic Changelog Update (#1460)
SimpleStation14 Jan 8, 2025
f80f954
Increase Title/Content Text Limits For News Articles (#1447)
angelofallars Jan 8, 2025
4a806c8
Automatic Changelog Update (#1447)
SimpleStation14 Jan 8, 2025
e733fa0
Chem Colors (#1461)
aspiringLich Jan 8, 2025
64d4323
Automatic Changelog Update (#1461)
SimpleStation14 Jan 8, 2025
089a45e
Fix Cybersun Pen Damage (#1459)
angelofallars Jan 8, 2025
bea6ca7
Automatic Changelog Update (#1459)
SimpleStation14 Jan 8, 2025
70f7298
Fixed Shadow Shackles Not Activating for Blood Cultists (#1456)
Lumminal Jan 8, 2025
442e25b
Automatic Changelog Update (#1456)
SimpleStation14 Jan 8, 2025
8b5eec7
Fix Face Markings Rendering Above Clothing (#1467)
angelofallars Jan 8, 2025
998e0ea
Automatic Changelog Update (#1467)
SimpleStation14 Jan 8, 2025
b39e126
Prisoner Headset Box in Warden's Locker (#1470)
Lumminal Jan 9, 2025
4907639
Automatic Changelog Update (#1470)
SimpleStation14 Jan 9, 2025
86296da
Adds Missing Lathe Recipes (#1472)
BlueHNT Jan 10, 2025
b89412a
Some Surgery Fixs (#1471)
Spatison Jan 10, 2025
77a7295
Automatic Changelog Update (#1472)
SimpleStation14 Jan 10, 2025
ba616f0
Automatic Changelog Update (#1471)
SimpleStation14 Jan 10, 2025
0f48142
Night And Thermal Vision (#1462)
Spatison Jan 10, 2025
83fa923
Automatic Changelog Update (#1462)
SimpleStation14 Jan 10, 2025
9c65527
Merge branch 'master' into station-ai
VMSolidus Jan 10, 2025
b38b7f9
CyberEyes Night Vision And Thermal Vision Modules (#1477)
VMSolidus Jan 10, 2025
7f32e00
Automatic Changelog Update (#1477)
SimpleStation14 Jan 10, 2025
df8ffb0
Assay Psionic Power (#1450)
VMSolidus Jan 11, 2025
f0a9bbd
Automatic Changelog Update (#1450)
SimpleStation14 Jan 11, 2025
6941a01
Update dev_map.yml
VMSolidus Jan 11, 2025
5a13b27
How the fuck did AI not have these?
VMSolidus Jan 11, 2025
0b0e9a8
I managed to get both AI Latejoin and Prisoner Latejoin working at th…
metalgearsloth Aug 29, 2024
5242ceb
Make AI Not Spawn With Clothes
VMSolidus Jan 11, 2025
6903924
Station AI (#1423)
VMSolidus Jan 11, 2025
14f738d
Automatic Changelog Update (#1423)
SimpleStation14 Jan 11, 2025
d662644
Hiding and clearing department prototype code (#28114)
Peptide90 Jan 11, 2025
a89b6cb
Meta with AI
Mike32oz Jan 11, 2025
1a6bd6f
Fixup playerspawn stuff (#31546)
Fildrance Sep 27, 2024
a906ed7
feat: now when research is unlocked in console, approver of reasearch…
Fildrance Sep 3, 2024
c4d14da
Update SharedStationAiSystem.Held.cs
VMSolidus Jan 11, 2025
d7317a7
Update SharedStationAiSystem.Held.cs
VMSolidus Jan 11, 2025
f293d7e
add access reader log wire (#29094)
deltanedas Jun 22, 2024
1709427
Update AccessReaderSystem.cs
VMSolidus Jan 11, 2025
0f7a662
wheeee
VMSolidus Jan 11, 2025
e2526ec
Meta with AI (#1484)
VMSolidus Jan 11, 2025
12bf563
Automatic Changelog Update (#1484)
SimpleStation14 Jan 11, 2025
0ce4d63
Update silicon.yml
VMSolidus Jan 11, 2025
fa35a3a
Hiding and Clearing Department Prototype Code (#28114) (#1483)
VMSolidus Jan 11, 2025
81bab8a
Fix Ai Accessible Consoles (#1485)
VMSolidus Jan 11, 2025
19f894d
Add Station AI To Gax (#1486)
VMSolidus Jan 11, 2025
afa2085
Automatic Changelog Update (#1486)
SimpleStation14 Jan 11, 2025
7485e8d
Senior Physician CPR (#1476)
VMSolidus Jan 11, 2025
2f6f7be
Fix AbsorbentTest & Shadowkin Test Fail (#1458)
sleepyyapril Jan 11, 2025
02dfa2e
Radstation AI (#1487)
VMSolidus Jan 11, 2025
3ebe76e
Automatic Changelog Update (#1487)
SimpleStation14 Jan 11, 2025
e389dff
Porting over My Cruise Control Code From Frontier (#1482)
neuPanda Jan 11, 2025
07401aa
Automatic Changelog Update (#1482)
SimpleStation14 Jan 11, 2025
e2d4a32
Port Frontier Guns And The Den PRs For Them (#1490)
VMSolidus Jan 11, 2025
634ace4
Automatic Changelog Update (#1490)
SimpleStation14 Jan 11, 2025
c2c18f5
Fix Announcement Spam (#1491)
sleepyyapril Jan 11, 2025
a050d4e
Automatic Changelog Update (#1491)
SimpleStation14 Jan 11, 2025
9897094
Material Silo (#1488)
Spatison Jan 11, 2025
289a2a7
Automatic Changelog Update (#1488)
SimpleStation14 Jan 11, 2025
afec1f9
Add Exclusivity Between Visual Traits and Cyber-Eyes Functionality (#…
Tirochora Jan 11, 2025
1547782
Automatic Changelog Update (#1492)
SimpleStation14 Jan 11, 2025
bcb1ccf
Update SharedStationAiSystem.cs (#1494)
VMSolidus Jan 11, 2025
7e13e06
Shadow Shackles Do After (#1466)
Spatison Jan 11, 2025
60d7733
Automatic Changelog Update (#1466)
SimpleStation14 Jan 11, 2025
7adee59
[Fix] Fixed Shadowking Throwing Errors when Spawning as a Random Huma…
Remuchi Jan 11, 2025
d2ef7e2
Add Station AI And Ore Silo To (Almost) All Maps (#1499)
VMSolidus Jan 11, 2025
3b5303c
Automatic Changelog Update (#1499)
SimpleStation14 Jan 11, 2025
1f6e1cb
Remove NPC Stormtrooper Mode (#1500)
VMSolidus Jan 11, 2025
28415f1
Fixes Weather Soundspam(And Crash) (#1501)
VMSolidus Jan 11, 2025
2a6107b
Automatic Changelog Update (#1500)
SimpleStation14 Jan 11, 2025
d7955f5
Automatic Changelog Update (#1501)
SimpleStation14 Jan 11, 2025
5ebee12
PlayTime Unlock Command (#1464)
sleepyyapril Jan 11, 2025
5943790
Automatic Changelog Update (#1464)
SimpleStation14 Jan 11, 2025
64a389a
v239.0.0 + .NET 9 (#1475)
sleepyyapril Jan 11, 2025
5b21f40
Fix Db Migrations (#1503)
sleepyyapril Jan 12, 2025
7f6b932
Merge pull request #1 from Aidenkrz/setup
Aidenkrz Oct 13, 2024
bf0f57b
Merge pull request #3 from Aidenkrz/upstreammerge
Aidenkrz Oct 16, 2024
e87faea
Merge pull request #5 from Aidenkrz/rebrand
Aidenkrz Oct 17, 2024
4d986b7
bruh
Aidenkrz Jan 12, 2025
5123005
Gun Rebalancing - Rifles (#11)
TwoDucksOnnaPlane Oct 30, 2024
d252ba3
Makes Role Timers Not Shit (#12)
starch70 Oct 30, 2024
6d36d2e
Add Server Rules and Standard Operating Procedure (#17)
CerberusWolfie Jan 1, 2025
ad5c820
Merge pull request #19 from CerberusWolfie/SOPHotFix
Aidenkrz Jan 6, 2025
263ac15
Gun Rebalancing Pt. 2 - Literally Everything Else (I Think) (#28)
TwoDucksOnnaPlane Jan 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/build-docfx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.100

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-map-renderer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.100

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.100

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.100

- name: Get Engine Tag
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.100

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yaml-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.100
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"url": "https://raw.githubusercontent.com/Simple-Station/Einstein-Engines/master/.github/rsi-schema.json"
}
]
}
}
2 changes: 1 addition & 1 deletion Content.Client/Administration/UI/BanPanel/BanPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public BanPanel()
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
foreach (var proto in prototypeManager.EnumeratePrototypes<DepartmentPrototype>())
{
CreateRoleGroup(proto.ID, proto.Roles, proto.Color);
CreateRoleGroup(proto.ID, proto.Roles.Select(p => p.Id), proto.Color);
}

CreateRoleGroup("Antagonist", prototypeManager.EnumeratePrototypes<AntagPrototype>().Select(p => p.ID), Color.Red);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<cc:UICommandButton Command="callshuttle" Text="{Loc admin-player-actions-window-shuttle}" WindowType="{x:Type at:AdminShuttleWindow}"/>
<cc:CommandButton Command="adminlogs" Text="{Loc admin-player-actions-window-admin-logs}"/>
<cc:CommandButton Command="faxui" Text="{Loc admin-player-actions-window-admin-fax}"/>
<cc:CommandButton Command="timetransferpanel" Text="{Loc admin-player-actions-window-time-transfer}"/>
</GridContainer>
</BoxContainer>
</Control>
8 changes: 0 additions & 8 deletions Content.Client/Bed/SleepingSystem.cs

This file was deleted.

13 changes: 5 additions & 8 deletions Content.Client/Chat/UI/EmotesMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@ public sealed partial class EmotesMenu : RadialMenu
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;

private readonly SpriteSystem _spriteSystem;
private readonly EntityWhitelistSystem _whitelistSystem;

public event Action<ProtoId<EmotePrototype>>? OnPlayEmote;

public EmotesMenu()
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);

_spriteSystem = _entManager.System<SpriteSystem>();
_whitelistSystem = _entManager.System<EntityWhitelistSystem>();
var spriteSystem = _entManager.System<SpriteSystem>();
var whitelistSystem = _entManager.System<EntityWhitelistSystem>();

var main = FindControl<RadialContainer>("Main");

Expand All @@ -40,8 +37,8 @@ public EmotesMenu()
var player = _playerManager.LocalSession?.AttachedEntity;
if (emote.Category == EmoteCategory.Invalid ||
emote.ChatTriggers.Count == 0 ||
!(player.HasValue && _whitelistSystem.IsWhitelistPassOrNull(emote.Whitelist, player.Value)) ||
_whitelistSystem.IsBlacklistPass(emote.Blacklist, player.Value))
!(player.HasValue && whitelistSystem.IsWhitelistPassOrNull(emote.Whitelist, player.Value)) ||
whitelistSystem.IsBlacklistPass(emote.Blacklist, player.Value))
continue;

if (!emote.Available &&
Expand All @@ -63,7 +60,7 @@ public EmotesMenu()
{
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Center,
Texture = _spriteSystem.Frame0(emote.Icon),
Texture = spriteSystem.Frame0(emote.Icon),
TextureScale = new Vector2(2f, 2f),
};

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Commands/SetMenuVisibilityCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Client.Verbs;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Shared.Console;

Expand Down
19 changes: 16 additions & 3 deletions Content.Client/ContextMenu/UI/EntityMenuUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Content.Shared.Examine;
using Content.Shared.IdentityManagement;
using Content.Shared.Input;
using Content.Shared.Verbs;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Input;
Expand Down Expand Up @@ -194,8 +195,20 @@ public override void FrameUpdate(FrameEventArgs args)
return;

// Do we need to do in-range unOccluded checks?
var ignoreFov = !_eyeManager.CurrentEye.DrawFov ||
(_verbSystem.Visibility & MenuVisibility.NoFov) == MenuVisibility.NoFov;
var visibility = _verbSystem.Visibility;

if (!_eyeManager.CurrentEye.DrawFov)
{
visibility &= ~MenuVisibility.NoFov;
}

var ev = new MenuVisibilityEvent()
{
Visibility = visibility,
};

_entityManager.EventBus.RaiseLocalEvent(player, ref ev);
visibility = ev.Visibility;

_entityManager.TryGetComponent(player, out ExaminerComponent? examiner);
var xformQuery = _entityManager.GetEntityQuery<TransformComponent>();
Expand All @@ -209,7 +222,7 @@ public override void FrameUpdate(FrameEventArgs args)
continue;
}

if (ignoreFov)
if ((visibility & MenuVisibility.NoFov) == MenuVisibility.NoFov)
continue;

var pos = new MapCoordinates(_xform.GetWorldPosition(xform, xformQuery), xform.MapID);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<DefaultWindow xmlns="https://spacestation14.io"
Title="{Loc nano-chat-new-title}"
Title="{Loc nano-chat-edit-title}"
MinSize="300 200">
<PanelContainer StyleClasses="AngleRect">
<BoxContainer Orientation="Vertical" Margin="4">
Expand Down Expand Up @@ -42,8 +42,8 @@
Text="{Loc nano-chat-cancel}"
StyleClasses="OpenRight"
MinSize="80 0" />
<Button Name="CreateButton"
Text="{Loc nano-chat-create}"
<Button Name="ConfirmButton"
Text="{Loc nano-chat-confirm}"
StyleClasses="OpenLeft"
MinSize="80 0"
Disabled="True" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Linq;
using Content.Client.DeltaV.NanoChat;
using Content.Shared.Access.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
Expand All @@ -9,9 +9,14 @@ namespace Content.Client.DeltaV.CartridgeLoader.Cartridges;
[GenerateTypedNameReferences]
public sealed partial class EditChatPopup : DefaultWindow
{
private const int MaxInputLength = 16;
private const int MaxNumberLength = 4;

// Used to see if the user input is different from the original data
// to check if the user can submit
private string _originalNumber = "";
private string _originalName = "";
private string _originalJob = "";

public event Action<uint, string, string?>? OnContactEdited;

public EditChatPopup()
Expand All @@ -23,22 +28,23 @@ public EditChatPopup()

// Button handlers
CancelButton.OnPressed += _ => Close();
CreateButton.OnPressed += _ => EditChat();
ConfirmButton.OnPressed += _ => EditChat();

// Input validation
NameInput.OnTextChanged += _ => ValidateInputs();

NameInput.OnTextChanged += args =>
{
if (args.Text.Length > MaxInputLength)
NameInput.Text = args.Text[..MaxInputLength];
if (args.Text.Length > IdCardConsoleComponent.MaxFullNameLength)
NameInput.Text = args.Text[..IdCardConsoleComponent.MaxFullNameLength];
ValidateInputs();
};

JobInput.OnTextChanged += args =>
{
if (args.Text.Length > MaxInputLength)
JobInput.Text = args.Text[..MaxInputLength];
if (args.Text.Length > IdCardConsoleComponent.MaxJobTitleLength)
JobInput.Text = args.Text[..IdCardConsoleComponent.MaxJobTitleLength];
ValidateInputs();
};

NumberInput.OnTextChanged += args =>
Expand All @@ -58,10 +64,15 @@ public EditChatPopup()
private void ValidateInputs()
{
var isValid = !string.IsNullOrWhiteSpace(NumberInput.Text) &&
!string.IsNullOrWhiteSpace(NameInput.Text) &&
uint.TryParse(NumberInput.Text, out _);

CreateButton.Disabled = !isValid;
!string.IsNullOrWhiteSpace(NameInput.Text) &&
NumberInput.Text.Length == MaxNumberLength &&
uint.TryParse(NumberInput.Text, out _) &&
// Only valid if there are any changes
(NumberInput.Text != _originalNumber ||
NameInput.Text != _originalName ||
JobInput.Text != _originalJob);

ConfirmButton.Disabled = !isValid;
}

private void EditChat()
Expand All @@ -83,7 +94,21 @@ public void ClearInputs()
ValidateInputs();
}

public void SetNumberInput(string newNumber) => NumberInput.Text = newNumber;
public void SetNameInput(string newName) => NameInput.Text = newName;
public void SetJobInput(string newJob) => JobInput.Text = newJob;
public void SetNumberInput(string newNumber)
{
NumberInput.Text = newNumber.PadLeft(MaxNumberLength, '0');
_originalNumber = newNumber;
}

public void SetNameInput(string newName)
{
NameInput.Text = newName;
_originalName = newName;
}

public void SetJobInput(string newJob)
{
JobInput.Text = newJob;
_originalJob = newJob;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ namespace Content.Client.DeltaV.CartridgeLoader.Cartridges;
[GenerateTypedNameReferences]
public sealed partial class NanoChatEntry : BoxContainer
{
private const int MaxNameLength = 14;
private const int MaxJobLength = 20;

public event Action<uint>? OnPressed;
private uint _number;
private Action<EventArgs>? _pressHandler;
Expand All @@ -29,11 +32,19 @@ public void SetRecipient(NanoChatRecipient recipient, uint number, bool isSelect
_pressHandler = _ => OnPressed?.Invoke(_number);
ChatButton.OnPressed += _pressHandler;

NameLabel.Text = recipient.Name;
JobLabel.Text = recipient.JobTitle ?? "";
NameLabel.Text = Truncate(recipient.Name, MaxNameLength);
JobLabel.Text = Truncate(recipient.JobTitle ?? "", MaxJobLength);
JobLabel.Visible = !string.IsNullOrEmpty(recipient.JobTitle);
UnreadIndicator.Visible = recipient.HasUnread;

ChatButton.ModulateSelfOverride = isSelected ? NanoChatMessageBubble.OwnMessageColor : null;
}

/// <summary>
/// Truncates a string to a maximum length.
/// </summary>
private static string Truncate(string text, int maxLength) =>
text.Length <= maxLength
? text
: text[..(maxLength - 3)] + "...";
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@
VerticalAlignment="Center"
Margin="0 0 8 0" />
<Button Name="EditChatButton"
Text="E"
MaxSize="32 32"
Visible="False"
StyleClasses="OpenBoth"
Margin="0 0 4 0"
ToolTip="{Loc nano-chat-edit}">
<TextureRect StyleClasses="ButtonSquare"
TexturePath="/Textures/Interface/VerbIcons/edit.svg.png"
Stretch="KeepAspectCentered"
MinSize="18 18" />
</Button>
<Button Name="DeleteChatButton"
MaxSize="32 32"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public sealed partial class NanoChatUiFragment : BoxContainer
{
[Dependency] private readonly IGameTiming _timing = default!;

private const int MaxMessageLength = 256;

private readonly NewChatPopup _newChatPopup;
private readonly EditChatPopup _editChatPopup;
private uint? _currentChat;
Expand Down Expand Up @@ -50,8 +48,7 @@ private void SetupEventHandlers()

_editChatPopup.OnContactEdited += (number, name, job) =>
{
DeleteCurrentChat();
ActionSendUiMessage?.Invoke(NanoChatUiMessageType.NewChat, number, name, job);
ActionSendUiMessage?.Invoke(NanoChatUiMessageType.EditChat, number, name, job);
};

NewChatButton.OnPressed += _ =>
Expand All @@ -71,18 +68,18 @@ private void SetupEventHandlers()
{
var length = args.Text.Length;
var isValid = !string.IsNullOrWhiteSpace(args.Text) &&
length <= MaxMessageLength &&
length <= NanoChatMessage.MaxContentLength &&
(_currentChat != null || _pendingChat != null);

SendButton.Disabled = !isValid;

// Show character count when over limit
CharacterCount.Visible = length > MaxMessageLength;
if (length > MaxMessageLength)
CharacterCount.Visible = length > NanoChatMessage.MaxContentLength;
if (length > NanoChatMessage.MaxContentLength)
{
CharacterCount.Text = Loc.GetString("nano-chat-message-too-long",
("current", length),
("max", MaxMessageLength));
("max", NanoChatMessage.MaxContentLength));
CharacterCount.StyleClasses.Add("LabelDanger");
}
};
Expand All @@ -100,6 +97,12 @@ private void SendMessage()
return;

var messageContent = MessageInput.Text;
if (!string.IsNullOrWhiteSpace(messageContent))
{
messageContent = messageContent.Trim();
if (messageContent.Length > NanoChatMessage.MaxContentLength)
messageContent = messageContent[..NanoChatMessage.MaxContentLength];
}

// Add predicted message
var predictedMessage = new NanoChatMessage(
Expand Down
Loading
Loading