Skip to content

Commit

Permalink
gogogo
Browse files Browse the repository at this point in the history
  • Loading branch information
Tryded committed Feb 20, 2025
2 parents 0fb5df1 + 116b7c3 commit 1feace3
Show file tree
Hide file tree
Showing 181 changed files with 3,192 additions and 1,808 deletions.
1 change: 1 addition & 0 deletions .github/workflows/labeler-needsreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

permissions:
pull-requests: write
issues: write
contents: write

jobs:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<cartridges:NanoChatLookupView
xmlns="https://spacestation14.io"
xmlns:cartridges="clr-namespace:Content.Client._DV.CartridgeLoader.Cartridges"
HorizontalExpand="True"
VerticalExpand="True"
StyleClasses="AngleRect">
<ScrollContainer Margin="-10"
VerticalExpand="True"
HorizontalExpand="True">
<BoxContainer Name="ContactsList"
Orientation="Vertical"
VerticalExpand="True"
HorizontalExpand="True" />
</ScrollContainer>
</cartridges:NanoChatLookupView>
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using System.Numerics;
using Content.Shared._DV.CartridgeLoader.Cartridges;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._DV.CartridgeLoader.Cartridges;

[GenerateTypedNameReferences]
public sealed partial class NanoChatLookupView : PanelContainer
{
public NanoChatLookupView()
{
RobustXamlLoader.Load(this);
}

public event Action<NanoChatRecipient>? OnStartChat;

public void UpdateContactList(NanoChatUiState state)
{
ContactsList.RemoveAllChildren();
if (state.Contacts is not { } contacts)
{
ContactsList.AddChild(new Label() { Text = Loc.GetString("nano-chat-look-up-no-server") });
return;
}

for (var idx = 0; idx < contacts.Count; idx++)
{
var contact = contacts[idx];
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 == state.OwnNumber || state.Recipients.ContainsKey(contact.Number) || state.MaxRecipients <= state.Recipients.Count)
{
startChatButton.Disabled = true;
}
startChatButton.OnPressed += _ => OnStartChat?.Invoke(contact);

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

panel.AddChild(nameLabel);
panel.AddChild(numberLabel);
panel.AddChild(startChatButton);

var styleClass = idx % 2 == 0 ? "PanelBackgroundBaseDark" : "PanelBackgroundLight";
panel.StyleClasses.Add(styleClass);

ContactsList.AddChild(panel);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,33 @@
Margin="0 0 4 0"
StyleClasses="OpenBoth"
ToolTip="{Loc nano-chat-new-chat}" />
<Button Name="LookupButton"
MaxSize="32 32"
StyleClasses="OpenBoth"
Margin="0 0 4 0"
ToolTip="{Loc nano-chat-look-up}">
<TextureRect StyleClasses="ButtonSquare"
TexturePath="/Textures/Interface/VerbIcons/examine.svg.192dpi.png"
Stretch="KeepAspectCentered"
MinSize="18 18" />
</Button>
<Button Name="ListNumberButton"
MaxSize="32 32"
StyleClasses="OpenBoth"
Margin="0 0 4 0"
ToolTip="{Loc nano-chat-list-number}"
ToggleMode="True">
<TextureRect StyleClasses="ButtonSquare"
TexturePath="/Textures/_DV/Interface/VerbIcons/hamburger_icon.svg.png"
Stretch="KeepAspectCentered"
MinSize="18 18" />
</Button>
</BoxContainer>
</controls:StripeBack>

<!-- Main content split -->
<BoxContainer Orientation="Horizontal"
<BoxContainer Name="ChatView"
Orientation="Horizontal"
VerticalExpand="True"
HorizontalExpand="True"
Margin="0 5 0 0">
Expand Down Expand Up @@ -163,5 +185,7 @@
</BoxContainer>
</PanelContainer>
</BoxContainer>
<cartridges:NanoChatLookupView Name="LookupView"
Visible="False" />
</BoxContainer>
</cartridges:NanoChatUiFragment>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public sealed partial class NanoChatUiFragment : BoxContainer
private uint? _pendingChat;
private uint _ownNumber;
private bool _notificationsMuted;
private bool _listNumber = true;
private Dictionary<uint, NanoChatRecipient> _recipients = new();
private Dictionary<uint, List<NanoChatMessage>> _messages = new();

Expand Down Expand Up @@ -75,10 +76,34 @@ private void SetupEventHandlers()
}
};

LookupButton.OnPressed += _ => ToggleView();
LookupView.OnStartChat += contact =>
{
if (OnMessageSent is { } handler)
{
handler(NanoChatUiMessageType.NewChat, contact.Number, contact.Name, contact.JobTitle);
SelectChat(contact.Number);
ToggleView();
}
};
ListNumberButton.OnPressed += _ =>
{
_listNumber = !_listNumber;
UpdateListNumber();
OnMessageSent?.Invoke(NanoChatUiMessageType.ToggleListNumber, null, null, null);
};

SendButton.OnPressed += _ => SendMessage();
DeleteChatButton.OnPressed += _ => DeleteCurrentChat();
}

private void ToggleView()
{
ChatView.Visible = !ChatView.Visible;
LookupView.Visible = !ChatView.Visible;
LookupButton.Pressed = LookupView.Visible;
}

private void SendMessage()
{
var activeChat = _pendingChat ?? _currentChat;
Expand Down Expand Up @@ -220,12 +245,20 @@ private void UpdateMuteButton()
BellMutedIcon.Visible = _notificationsMuted;
}

private void UpdateListNumber()
{
if (ListNumberButton != null)
ListNumberButton.Pressed = _listNumber;
}

public void UpdateState(NanoChatUiState state)
{
_ownNumber = state.OwnNumber;
_notificationsMuted = state.NotificationsMuted;
_listNumber = state.ListNumber;
OwnNumberLabel.Text = $"#{state.OwnNumber:D4}";
UpdateMuteButton();
UpdateListNumber();

// Update new chat button state based on recipient limit
var atLimit = state.Recipients.Count >= state.MaxRecipients;
Expand All @@ -250,5 +283,6 @@ public void UpdateState(NanoChatUiState state)
UpdateCurrentChat();
UpdateChatList(state.Recipients);
UpdateMessages(state.Messages);
LookupView.UpdateContactList(state);
}
}
15 changes: 15 additions & 0 deletions Content.Client/_DV/Surgery/SurgeryCleanSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Content.Shared._DV.Surgery;

namespace Content.Client._DV.Surgery;

/// <summary>
/// This gets the examine tooltip and sanitize verb predicted on the client so there's no pop-in after latency
/// </summary>
public sealed class SurgeryCleanSystem : SharedSurgeryCleanSystem
{
public override bool RequiresCleaning(EntityUid target)
{
// Predict that it can be cleaned if it has dirt on it
return TryComp<SurgeryDirtinessComponent>(target, out var dirtiness) && dirtiness.Dirtiness > 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Input;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using System.Numerics;
Expand Down Expand Up @@ -43,7 +44,11 @@ public ShopVendorWindow()
VendingContents.SearchBar = SearchBar;
VendingContents.DataFilterCondition += DataFilterCondition;
VendingContents.GenerateItem += GenerateButton;
VendingContents.ItemKeyBindDown += (args, data) => OnItemSelected?.Invoke(((ShopVendorListingData) data).Index);
VendingContents.ItemKeyBindDown += (args, data) =>
{
if (args.Function == EngineKeyFunctions.UIClick)
OnItemSelected?.Invoke(((ShopVendorListingData) data).Index);
};
}

public void SetEntity(EntityUid owner)
Expand Down
28 changes: 27 additions & 1 deletion Content.Client/_Shitmed/Autodoc/PickSurgeryWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Client.UserInterface.Controls;
using Content.Shared._Shitmed.Autodoc;
using Content.Shared._Shitmed.Medical.Surgery;
using Content.Shared._Shitmed.Medical.Surgery.Conditions;
using Content.Shared.Body.Part;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
Expand Down Expand Up @@ -50,6 +51,7 @@ public PickSurgeryWindow()
{
args.Button.Select(args.Id);
_symmetry = args.Button.SelectedValue;
UpdateSurgeries();
};

foreach (var part in Enum.GetValues<BodyPartType>())
Expand All @@ -65,6 +67,7 @@ public PickSurgeryWindow()

_part = part;
UpdateSubmit();
UpdateSurgeries();
};
Parts.OnItemDeselected += _ =>
{
Expand Down Expand Up @@ -108,7 +111,30 @@ private void UpdateSurgeries()
foreach (var id in _surgery.AllSurgeries)
{
var name = _proto.Index(id).Name;
Surgeries.AddItem(name, metadata: new EntProtoId<SurgeryComponent>(id));
var protoId = new EntProtoId<SurgeryComponent>(id);
if (_part is not BodyPartType part)
{
Surgeries.AddItem(name, metadata: id);
continue;
}

var ent = _surgery.GetSingleton(protoId);
if (ent is null)
continue;

if (!_entMan.TryGetComponent<SurgeryPartConditionComponent>(ent.Value, out var comp))
{
Surgeries.AddItem(name, metadata: id);
continue;
}

var partOk = comp.Part == part;
var symmetryOk = (comp.Symmetry == null || _symmetry == null) ? true : comp.Symmetry == _symmetry;

var passesFilter = (partOk && symmetryOk) ^ comp.Inverse;

if (passesFilter)
Surgeries.AddItem(name, metadata: id);
}
Surgeries.SortItemsByText();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Server.Explosion.Components;
using Content.Server.Weapons.Ranged.Systems;
using Content.Shared.Weapons.Ranged.Components; // Imp
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.Map;
Expand Down Expand Up @@ -77,6 +78,7 @@ private void FragmentIntoProjectiles(EntityUid uid, ProjectileGrenadeComponent c
// slightly uneven, doesn't really change much, but it looks better
var direction = angle.ToVec().Normalized();
var velocity = _random.NextVector2(component.MinVelocity, component.MaxVelocity);
EnsureComp<TargetedProjectileComponent>(contentUid); // imp - ensure projectile is a TargetedProjectile with no target to hit crawling players
_gun.ShootProjectile(contentUid, direction, velocity, uid, null);
}
}
Expand Down
20 changes: 13 additions & 7 deletions Content.Server/Implants/ImplantedSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Server.Body.Components;
using Content.Shared.Implants.Components;
using Content.Shared.Storage;
using Robust.Shared.Containers;

namespace Content.Server.Implants;
Expand All @@ -13,21 +14,26 @@ public void InitializeImplanted()
SubscribeLocalEvent<ImplantedComponent, BeingGibbedEvent>(OnGibbed);
}

private void OnImplantedInit(EntityUid uid, ImplantedComponent component, ComponentInit args)
private void OnImplantedInit(Entity<ImplantedComponent> ent, ref ComponentInit args)
{
component.ImplantContainer = _container.EnsureContainer<Container>(uid, ImplanterComponent.ImplantSlotId);
component.ImplantContainer.OccludesLight = false;
ent.Comp.ImplantContainer = _container.EnsureContainer<Container>(ent.Owner, ImplanterComponent.ImplantSlotId);
ent.Comp.ImplantContainer.OccludesLight = false;
}

private void OnShutdown(EntityUid uid, ImplantedComponent component, ComponentShutdown args)
private void OnShutdown(Entity<ImplantedComponent> ent, ref ComponentShutdown args)
{
//If the entity is deleted, get rid of the implants
_container.CleanContainer(component.ImplantContainer);
_container.CleanContainer(ent.Comp.ImplantContainer);
}

private void OnGibbed(Entity<ImplantedComponent> ent, ref BeingGibbedEvent args)
{
//If the entity is gibbed, get rid of the implants
_container.CleanContainer(ent.Comp.ImplantContainer);
// Drop the storage implant contents before the implants are deleted by the body being gibbed
foreach (var implant in ent.Comp.ImplantContainer.ContainedEntities)
{
if (TryComp<StorageComponent>(implant, out var storage))
_container.EmptyContainer(storage.Container, destination: Transform(ent).Coordinates);
}

}
}
1 change: 1 addition & 0 deletions Content.Server/NPC/Systems/NPCCombatSystem.Ranged.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ private void UpdateRanged(float frameTime)
return;
}

_gun.SetTarget(gun, comp.Target); // Imp
_gun.AttemptShoot(uid, gunUid, gun, targetCordinates);
}
}
Expand Down
22 changes: 0 additions & 22 deletions Content.Server/Nyanotrasen/Abilities/Boxer/Boxer/BoxerComponent.cs

This file was deleted.

Loading

0 comments on commit 1feace3

Please sign in to comment.