Skip to content

Commit

Permalink
Merge branch 'master' into cap-trenchcoat
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepyyapril authored Dec 31, 2024
2 parents ea802f6 + 34de3a7 commit d002bc6
Show file tree
Hide file tree
Showing 95 changed files with 1,939 additions and 379 deletions.
63 changes: 54 additions & 9 deletions Content.Client/Communications/UI/CommunicationsConsoleMenu.xaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,62 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'comms-console-menu-title'}"
MinSize="400 225">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" Margin="5">
<TextEdit Name="MessageInput" HorizontalExpand="True" VerticalExpand="True" Margin="0 0 0 5" MinHeight="100" />
<Button Name="AnnounceButton" Text="{Loc 'comms-console-menu-announcement-button'}" StyleClasses="OpenLeft" Access="Public" />
<Button Name="BroadcastButton" Text="{Loc 'comms-console-menu-broadcast-button'}" StyleClasses="OpenLeft" Access="Public" />
MinSize="400 300">

<OptionButton Name="AlertLevelButton" StyleClasses="OpenRight" Access="Public" />
<!-- Main Container -->
<BoxContainer Orientation="Vertical"
HorizontalExpand="False"
VerticalExpand="True"
Margin="6 6 6 5">

<Control MinSize="10 10" />
<TextEdit Name="MessageInput"
VerticalExpand="True"
HorizontalExpand="True"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
MinHeight="100"/>

<RichTextLabel Name="CountdownLabel" VerticalExpand="True" />
<Button Name="EmergencyShuttleButton" Text="Placeholder Text" Access="Public" />
<!-- ButtonsPart -->
<BoxContainer Orientation="Vertical"
VerticalAlignment="Bottom"
SeparationOverride="4">

<!-- AnnouncePart -->
<BoxContainer Orientation="Vertical"
Margin="0 2">

<Button Name="AnnounceButton"
Access="Public"
Text="{Loc 'comms-console-menu-announcement-button'}"
ToolTip="{Loc 'comms-console-menu-announcement-button-tooltip'}"
StyleClasses="OpenLeft"
Margin="0 0 1 0"
Disabled="True"/>

<Button Name="BroadcastButton"
Access="Public"
Text="{Loc 'comms-console-menu-broadcast-button'}"
ToolTip="{Loc 'comms-console-menu-broadcast-button-tooltip'}"
StyleClasses="OpenBoth"/>

<OptionButton Name="AlertLevelButton"
Access="Public"
ToolTip="{Loc 'comms-console-menu-alert-level-button-tooltip'}"
StyleClasses="OpenRight"/>

</BoxContainer>

<!-- EmergencyPart -->
<BoxContainer Orientation="Vertical"
SeparationOverride="6">

<RichTextLabel Name="CountdownLabel"/>

<Button Name="EmergencyShuttleButton"
Access="Public"
Text="Placeholder Text"
ToolTip="{Loc 'comms-console-menu-emergency-shuttle-button-tooltip'}"/>
</BoxContainer>
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void UpdateCountdown()

EmergencyShuttleButton.Text = Loc.GetString("comms-console-menu-recall-shuttle");
var infoText = Loc.GetString($"comms-console-menu-time-remaining",
("time", diff.TotalSeconds.ToString(CultureInfo.CurrentCulture)));
("time", diff.ToString(@"hh\:mm\:ss", CultureInfo.CurrentCulture)));
CountdownLabel.SetMessage(infoText);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ private void UpdateDimensions(SliderUpdate updateType)

if (updateType == SliderUpdate.Height || updateType == SliderUpdate.Both)
if (ratio < 1 / sizeRatio || ratio > sizeRatio)
widthValue = heightValue * (ratio < 1 / sizeRatio ? (1 / sizeRatio) : sizeRatio);
widthValue = heightValue / (ratio < 1 / sizeRatio ? (1 / sizeRatio) : sizeRatio);

if (updateType == SliderUpdate.Width || updateType == SliderUpdate.Both)
if (ratio < 1 / sizeRatio || ratio > sizeRatio)
Expand Down
1 change: 0 additions & 1 deletion Content.Client/Mech/Ui/MechBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@ public void UpdateEquipmentControls(MechBoundUiState state)
return component?.Ui;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping.Unary.Components;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Content.Server.Power.EntitySystems;
using Content.Shared.UserInterface;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
Expand Down Expand Up @@ -142,7 +143,7 @@ private bool IsHeater(GasThermoMachineComponent comp)

private void OnToggleMessage(EntityUid uid, GasThermoMachineComponent thermoMachine, GasThermomachineToggleMessage args)
{
var powerState = _power.IsPowered(uid);
var powerState = _power.TogglePower(uid);
_adminLogger.Add(LogType.AtmosPowerChanged, $"{ToPrettyString(args.Actor)} turned {(powerState ? "On" : "Off")} {ToPrettyString(uid)}");
DirtyUI(uid, thermoMachine);
}
Expand Down
15 changes: 11 additions & 4 deletions Content.Server/Carrying/CarryingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,17 @@ private void OnMobStateChanged(EntityUid uid, CarryingComponent component, MobSt
/// </summary>
private void OnInteractionAttempt(EntityUid uid, BeingCarriedComponent component, InteractionAttemptEvent args)
{
if (args.Target == null)
// Floofstation - function body reviewed
Predicate<TransformComponent> isChildOfCarrier = null!; // C# doesn't have local functions eugh
isChildOfCarrier = (childXForm) => childXForm.ParentUid == component.Carrier
|| (childXForm.ParentUid is { Valid: true } parent && isChildOfCarrier(Transform(parent)));

if (args.Target == null // Allow self-interacts
|| isChildOfCarrier(Transform(args.Target.Value))) // Allow interacting with everything on the carriee
return;

// Also check if the interacted-with entity is on the carrier and cancel the event if not
var targetParent = Transform(args.Target.Value).ParentUid;

if (args.Target.Value != component.Carrier && targetParent != component.Carrier && targetParent != uid)
args.Cancel();
}
Expand Down Expand Up @@ -201,8 +207,9 @@ private void OnStandAttempt(EntityUid uid, BeingCarriedComponent component, Stan

private void OnInteractedWith(EntityUid uid, BeingCarriedComponent component, GettingInteractedWithAttemptEvent args)
{
if (args.Uid != component.Carrier)
args.Cancel();
// Floofstation - why.
// if (args.Uid != component.Carrier)
// args.Cancel();
}

private void OnPullAttempt(EntityUid uid, BeingCarriedComponent component, PullAttemptEvent args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Content.Shared.DeltaV.NanoChat;
using Content.Shared.PDA;
using Content.Shared.Radio.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;

Expand All @@ -25,6 +26,7 @@ public sealed class NanoChatCartridgeSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly SharedNanoChatSystem _nanoChat = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly UserInterfaceSystem _ui = default!;

// Messages in notifications get cut off after this point
// no point in storing it on the comp
Expand Down
15 changes: 11 additions & 4 deletions Content.Server/Eye/Blinding/EyeProtection/EyeProtectionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ public override void Initialize()
SubscribeLocalEvent<EyeProtectionComponent, InventoryRelayedEvent<GetEyeProtectionEvent>>(OnGetRelayedProtection);
}

private void OnGetRelayedProtection(EntityUid uid, EyeProtectionComponent component,
InventoryRelayedEvent<GetEyeProtectionEvent> args)
private void OnGetRelayedProtection(
EntityUid uid,
EyeProtectionComponent component,
InventoryRelayedEvent<GetEyeProtectionEvent> args
)
{
OnGetProtection(uid, component, args.Args);
}
Expand Down Expand Up @@ -52,8 +55,12 @@ private void OnUseAttempt(EntityUid uid, RequiresEyeProtectionComponent componen
// how much damage they already accumulated.
_blindingSystem.AdjustEyeDamage((args.User, blindable), 1);
var statusTimeSpan = TimeSpan.FromSeconds(time * MathF.Sqrt(blindable.EyeDamage));
_statusEffectsSystem.TryAddStatusEffect(args.User, TemporaryBlindnessSystem.BlindingStatusEffect,
statusTimeSpan, false, TemporaryBlindnessSystem.BlindingStatusEffect);
_statusEffectsSystem.TryAddStatusEffect(
args.User,
TemporaryBlindnessSystem.BlindingStatusEffect,
statusTimeSpan,
false,
TemporaryBlindnessSystem.BlindingStatusEffect);
}
private void OnWelderToggled(EntityUid uid, RequiresEyeProtectionComponent component, ItemToggledEvent args)
{
Expand Down
24 changes: 24 additions & 0 deletions Content.Server/Language/TranslatorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
using Content.Server.PowerCell;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Item.ItemToggle.Components;
using Content.Shared.Language;
using Content.Shared.Language.Components;
using Content.Shared.Language.Systems;
using Content.Shared.PowerCell;
using Content.Shared.Language.Components.Translators;
using Content.Shared.Language.Events;
using Content.Shared.PowerCell.Components;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
Expand All @@ -33,6 +35,8 @@ public override void Initialize()
SubscribeLocalEvent<HandheldTranslatorComponent, EntParentChangedMessage>(OnTranslatorParentChanged);
SubscribeLocalEvent<HandheldTranslatorComponent, ActivateInWorldEvent>(OnTranslatorToggle);
SubscribeLocalEvent<HandheldTranslatorComponent, PowerCellSlotEmptyEvent>(OnPowerCellSlotEmpty);
SubscribeLocalEvent<HandheldTranslatorComponent, PowerCellChangedEvent>(OnPowerCellChanged);
SubscribeLocalEvent<HandheldTranslatorComponent, ItemToggledEvent>(OnItemToggled);
}

private void OnDetermineLanguages(EntityUid uid, IntrinsicTranslatorComponent component, DetermineEntityLanguagesEvent ev)
Expand Down Expand Up @@ -137,6 +141,26 @@ private void OnPowerCellSlotEmpty(EntityUid translator, HandheldTranslatorCompon
_language.UpdateEntityLanguages(holderCont.Owner);
}

private void OnPowerCellChanged(EntityUid translator, HandheldTranslatorComponent component, PowerCellChangedEvent args)
{
component.Enabled = !args.Ejected;
_powerCell.SetDrawEnabled(translator, !args.Ejected);
OnAppearanceChange(translator, component);

if (_containers.TryGetContainingContainer((translator, null, null), out var holderCont) && HasComp<LanguageSpeakerComponent>(holderCont.Owner))
_language.UpdateEntityLanguages(holderCont.Owner);
}

private void OnItemToggled(EntityUid translator, HandheldTranslatorComponent component, ItemToggledEvent args)
{
component.Enabled = args.Activated;
_powerCell.SetDrawEnabled(translator, args.Activated);
OnAppearanceChange(translator, component);

if (_containers.TryGetContainingContainer((translator, null, null), out var holderCont) && HasComp<LanguageSpeakerComponent>(holderCont.Owner))
_language.UpdateEntityLanguages(holderCont.Owner);
}

private void CopyLanguages(BaseTranslatorComponent from, DetermineEntityLanguagesEvent to, LanguageKnowledgeComponent knowledge)
{
var addSpoken = CheckLanguagesMatch(from.RequiredLanguages, knowledge.SpokenLanguages, from.RequiresAllLanguages);
Expand Down
3 changes: 2 additions & 1 deletion Content.Server/Medical/HealingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,11 @@ targetDamage.DamageContainerID is not null &&
var doAfterEventArgs =
new DoAfterArgs(EntityManager, user, delay, new HealingDoAfterEvent(), target, target: target, used: uid)
{
//Raise the event on the target if it's not self, otherwise raise it on self.
BreakOnMove = true,
// Didn't break on damage as they may be trying to prevent it and
// not being able to heal your own ticking damage would be frustrating.
NeedHand = true,
BreakOnMove = true,
BreakOnWeightlessMove = false,
};

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private void OnReceiveRadio(EntityUid uid, RadioSpeakerComponent component, ref
("originalName", nameEv.VoiceName));

// log to chat so people can identity the speaker/source, but avoid clogging ghost chat if there are many radios
_chat.TrySendInGameICMessage(uid, args.LanguageObfuscatedChatMsg.Message, InGameICChatType.Whisper, ChatTransmitRange.GhostRangeLimit, nameOverride: name, checkRadioPrefix: false);
_chat.TrySendInGameICMessage(uid, args.OriginalChatMsg.Message, InGameICChatType.Whisper, ChatTransmitRange.GhostRangeLimit, nameOverride: name, checkRadioPrefix: false);
}

private void OnIntercomEncryptionChannelsChanged(Entity<IntercomComponent> ent, ref EncryptionChannelsChangedEvent args)
Expand Down
17 changes: 10 additions & 7 deletions Content.Server/Radio/EntitySystems/RadioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,24 @@ private void OnIntrinsicSpeak(EntityUid uid, IntrinsicRadioTransmitterComponent
{
if (args.Channel != null && component.Channels.Contains(args.Channel.ID))
{
SendRadioMessage(uid, args.Message, args.Channel, uid);
SendRadioMessage(uid, args.Message, args.Channel, uid, args.Language);
args.Channel = null; // prevent duplicate messages from other listeners.
}
}

private void OnIntrinsicReceive(EntityUid uid, IntrinsicRadioReceiverComponent component, ref RadioReceiveEvent args)
{
var listener = args.RadioSource;
var msg = args.OriginalChatMsg;
if (TryComp(uid, out ActorComponent? actor))
{
// Einstein-Engines - languages mechanic
var listener = component.Owner;
var msg = args.OriginalChatMsg;

if (!_language.CanUnderstand(listener, args.Language.ID))
msg = args.LanguageObfuscatedChatMsg;
if (listener != null && !_language.CanUnderstand(listener, args.Language.ID))
msg = args.LanguageObfuscatedChatMsg;

if (TryComp(uid, out ActorComponent? actor))
_netMan.ServerSendMessage(new MsgChatMessage { Message = msg }, actor.PlayerSession.Channel);
_netMan.ServerSendMessage(new MsgChatMessage { Message = msg}, actor.PlayerSession.Channel);
}
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Radio/IntrinsicRadioKeySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ private void OnReceiverChannelsChanged(EntityUid uid, ActiveRadioComponent compo
UpdateChannels(uid, args.Component, ref component.Channels);
}

private void UpdateChannels(EntityUid _, EncryptionKeyHolderComponent keyHolderComp, ref HashSet<string> channels)
private void UpdateChannels(EntityUid _, EncryptionKeyHolderComponent component, ref HashSet<string> channels)
{
channels.Clear();
channels.UnionWith(keyHolderComp.Channels);
channels.UnionWith(component.Channels);
}
}
6 changes: 6 additions & 0 deletions Content.Shared/DeltaV/NanoChat/SharedNanoChatSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Shared.DeltaV.CartridgeLoader.Cartridges;
using Content.Shared.Examine;
using Content.Shared.PDA;
using Robust.Shared.Timing;

namespace Content.Shared.DeltaV.NanoChat;
Expand All @@ -10,6 +11,7 @@ namespace Content.Shared.DeltaV.NanoChat;
public abstract class SharedNanoChatSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SharedUserInterfaceSystem _ui = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -139,6 +141,10 @@ public void AddMessage(Entity<NanoChatCardComponent?> card, uint recipientNumber
if (!Resolve(card, ref card.Comp))
return null;

// If the UI is not open, no one is technically selected.
if (!_ui.IsUiOpen(card.Owner, PdaUiKey.Key))
return null;

return card.Comp.CurrentChat;
}

Expand Down
Loading

0 comments on commit d002bc6

Please sign in to comment.