Skip to content

Commit

Permalink
Merge pull request #199 from formlessnameless/dev
Browse files Browse the repository at this point in the history
Upstream imports, snail merges
  • Loading branch information
medabunny authored Sep 3, 2024
2 parents 58c7a6f + 42c4afe commit 99608f7
Show file tree
Hide file tree
Showing 79 changed files with 10,512 additions and 6,460 deletions.
10 changes: 9 additions & 1 deletion Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ public DefaultGameScreen()

Chat.OnResized += ChatOnResized;
Chat.OnChatResizeFinish += ChatOnResizeFinish;
Actions.ActionsContainer.Columns = 1;

MainViewport.OnResized += ResizeActionContainer;
Inventory.OnResized += ResizeActionContainer;
}

private void ResizeActionContainer()
{
float indent = Inventory.Size.Y + TopBar.Size.Y + 40;
Actions.ActionsContainer.MaxGridHeight = MainViewport.Size.Y - indent;
}

private void ChatOnResizeFinish(Vector2 _)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ public SeparatedChatGameScreen()

ScreenContainer.OnSplitResizeFinished += () =>
OnChatResized?.Invoke(new Vector2(ScreenContainer.SplitFraction, 0));

ViewportContainer.OnResized += ResizeActionContainer;
}

private void ResizeActionContainer()
{
float indent = 20;
Actions.ActionsContainer.MaxGridWidth = ViewportContainer.Size.X - indent;
}

public override ChatBox ChatBox => GetWidget<ChatBox>()!;
Expand Down
1 change: 1 addition & 0 deletions Content.Server/Access/Systems/IdCardSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public sealed class IdCardSystem : SharedIdCardSystem
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<IdCardComponent, BeingMicrowavedEvent>(OnMicrowaved);
}

Expand Down
26 changes: 16 additions & 10 deletions Content.Server/Cargo/Systems/CargoSystem.Orders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using Content.Shared.Cargo.Events;
using Content.Shared.Cargo.Prototypes;
using Content.Shared.Database;
using Content.Shared.Emag.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Paper;
using Robust.Shared.Map;
Expand Down Expand Up @@ -175,10 +177,6 @@ private void OnApproveOrderMessage(EntityUid uid, CargoOrderConsoleComponent com
RaiseLocalEvent(ref ev);
ev.FulfillmentEntity ??= station.Value;

_idCardSystem.TryFindIdCard(player, out var idCard);
// ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
order.SetApproverData(idCard.Comp?.FullName, idCard.Comp?.JobTitle);

if (!ev.Handled)
{
ev.FulfillmentEntity = TryFulfillOrder((station.Value, stationData), order, orderDatabase);
Expand All @@ -194,12 +192,20 @@ private void OnApproveOrderMessage(EntityUid uid, CargoOrderConsoleComponent com
order.Approved = true;
_audio.PlayPvs(component.ConfirmSound, uid);

var message = Loc.GetString("cargo-console-unlock-approved-order-broadcast",
("productName", Loc.GetString(order.ProductName)),
("orderAmount", order.OrderQuantity),
("approver", order.Approver ?? string.Empty),
("cost", cost));
_radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false);
if (!HasComp<EmaggedComponent>(uid))
{
var tryGetIdentityShortInfoEvent = new TryGetIdentityShortInfoEvent(uid, player);
RaiseLocalEvent(tryGetIdentityShortInfoEvent);
order.SetApproverData(tryGetIdentityShortInfoEvent.Title);

var message = Loc.GetString("cargo-console-unlock-approved-order-broadcast",
("productName", Loc.GetString(order.ProductName)),
("orderAmount", order.OrderQuantity),
("approver", order.Approver ?? string.Empty),
("cost", cost));
_radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false);
}

ConsolePopup(args.Actor, Loc.GetString("cargo-console-trade-station", ("destination", MetaData(ev.FulfillmentEntity.Value).EntityName)));

// Log order approval
Expand Down
2 changes: 0 additions & 2 deletions Content.Server/Cargo/Systems/CargoSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Content.Server.Access.Systems;
using Content.Server.Cargo.Components;
using Content.Server.DeviceLinking.Systems;
using Content.Server.Popups;
Expand Down Expand Up @@ -31,7 +30,6 @@ public sealed partial class CargoSystem : SharedCargoSystem
[Dependency] private readonly AccessReaderSystem _accessReaderSystem = default!;
[Dependency] private readonly DeviceLinkSystem _linker = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly IdCardSystem _idCardSystem = default!;
[Dependency] private readonly ItemSlotsSystem _slots = default!;
[Dependency] private readonly PaperSystem _paperSystem = default!;
[Dependency] private readonly PopupSystem _popup = default!;
Expand Down
21 changes: 4 additions & 17 deletions Content.Server/Communications/CommunicationsConsoleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
using System.Globalization;
using Content.Server.Access.Systems;
using Content.Server.Administration.Logs;
using Content.Server.AlertLevel;
using Content.Server.Chat.Systems;
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Interaction;
using Content.Server.Popups;
using Content.Server.RoundEnd;
using Content.Server.Screens;
using Content.Server.Screens.Components;
using Content.Server.Shuttles.Systems;
using Content.Server.Station.Systems;
Expand All @@ -21,8 +17,8 @@
using Content.Shared.Database;
using Content.Shared.DeviceNetwork;
using Content.Shared.Emag.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Popups;
using Content.Shared.Silicons.Borgs.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;
using Content.Server.Announcements.Systems;
Expand All @@ -38,7 +34,6 @@ public sealed class CommunicationsConsoleSystem : EntitySystem
[Dependency] private readonly ChatSystem _chatSystem = default!;
[Dependency] private readonly DeviceNetworkSystem _deviceNetworkSystem = default!;
[Dependency] private readonly EmergencyShuttleSystem _emergency = default!;
[Dependency] private readonly IdCardSystem _idCardSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly RoundEndSystem _roundEndSystem = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
Expand Down Expand Up @@ -255,17 +250,9 @@ private void OnAnnounceMessage(EntityUid uid, CommunicationsConsoleComponent com
return;
}

// User has an id
if (_idCardSystem.TryFindIdCard(mob, out var id))
{
author = $"{id.Comp.FullName} ({CultureInfo.CurrentCulture.TextInfo.ToTitleCase(id.Comp.JobTitle ?? string.Empty)})".Trim();
}

// User does not have an id and is a borg, so use the borg's name
if (HasComp<BorgChassisComponent>(mob))
{
author = Name(mob).Trim();
}
var tryGetIdentityShortInfoEvent = new TryGetIdentityShortInfoEvent(uid, mob);
RaiseLocalEvent(tryGetIdentityShortInfoEvent);
author = tryGetIdentityShortInfoEvent.Title;
}

comp.AnnouncementCooldownRemaining = comp.Delay;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Content.Shared.Security;
using Content.Shared.StationRecords;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
using System.Diagnostics.CodeAnalysis;
using Content.Shared.IdentityManagement;
using Content.Shared.Security.Components;
Expand All @@ -26,7 +25,6 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS
[Dependency] private readonly CriminalRecordsSystem _criminalRecords = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly RadioSystem _radio = default!;
[Dependency] private readonly SharedIdCardSystem _idCard = default!;
[Dependency] private readonly StationRecordsSystem _records = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly UserInterfaceSystem _ui = default!;
Expand Down Expand Up @@ -108,8 +106,13 @@ private void OnChangeStatus(Entity<CriminalRecordsConsoleComponent> ent, ref Cri

var name = _records.RecordName(key.Value);
var officer = Loc.GetString("criminal-records-console-unknown-officer");
if (_idCard.TryFindIdCard(mob.Value, out var id) && id.Comp.FullName is { } fullName)
officer = fullName;

var tryGetIdentityShortInfoEvent = new TryGetIdentityShortInfoEvent(null, mob.Value);
RaiseLocalEvent(tryGetIdentityShortInfoEvent);
if (tryGetIdentityShortInfoEvent.Title != null)
{
officer = tryGetIdentityShortInfoEvent.Title;
}

(string, object)[] args;
if (reason != null)
Expand Down
10 changes: 5 additions & 5 deletions Content.Server/MassMedia/Systems/NewsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using Content.Server.Access.Systems;
using Content.Server.Administration.Logs;
using Content.Server.CartridgeLoader;
using Content.Server.CartridgeLoader.Cartridges;
Expand All @@ -19,6 +18,7 @@
using Content.Shared.Popups;
using Robust.Server.GameObjects;
using Robust.Shared.Audio.Systems;
using Content.Shared.IdentityManagement;
using Robust.Shared.Timing;

namespace Content.Server.MassMedia.Systems;
Expand All @@ -35,7 +35,7 @@ public sealed class NewsSystem : SharedNewsSystem
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly GameTicker _ticker = default!;
[Dependency] private readonly IdCardSystem _idCardSystem = default!;
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
[Dependency] private readonly IChatManager _chatManager = default!;

public override void Initialize()
Expand Down Expand Up @@ -140,9 +140,9 @@ private void OnWriteUiPublishMessage(Entity<NewsWriterComponent> ent, ref NewsWr
ent.Comp.PublishEnabled = false;
ent.Comp.NextPublish = _timing.CurTime + TimeSpan.FromSeconds(ent.Comp.PublishCooldown);

string? authorName = null;
if (_idCardSystem.TryFindIdCard(msg.Actor, out var idCard))
authorName = idCard.Comp.FullName;
var tryGetIdentityShortInfoEvent = new TryGetIdentityShortInfoEvent(ent, msg.Actor);
RaiseLocalEvent(tryGetIdentityShortInfoEvent);
string? authorName = tryGetIdentityShortInfoEvent.Title;

var title = msg.Title.Trim();
var content = msg.Content.Trim();
Expand Down
1 change: 1 addition & 0 deletions Content.Server/Ninja/Systems/NinjaGlovesSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ protected override void EnableGloves(Entity<NinjaGlovesComponent> ent, Entity<Sp
{
var ev = new NinjaBatteryChangedEvent(battery.Value, suit);
RaiseLocalEvent(user, ref ev);
RaiseLocalEvent(suit, ref ev);
}
}
}
10 changes: 10 additions & 0 deletions Content.Server/Ninja/Systems/NinjaSuitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ protected override void NinjaEquipped(Entity<NinjaSuitComponent> ent, Entity<Spa
base.NinjaEquipped(ent, user);

_ninja.SetSuitPowerAlert(user);

// raise event to let ninja components get starting battery
_ninja.GetNinjaBattery(user.Owner, out var uid, out var _);

if (uid is not {} battery_uid)
return;

var ev = new NinjaBatteryChangedEvent(battery_uid, ent.Owner);
RaiseLocalEvent(ent, ref ev);
RaiseLocalEvent(user, ref ev);
}

// TODO: if/when battery is in shared, put this there too
Expand Down
1 change: 0 additions & 1 deletion Content.Server/Nutrition/EntitySystems/FoodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Content.Shared.Body.Components;
using Content.Shared.Body.Organ;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Database;
using Content.Shared.DoAfter;
using Content.Shared.FixedPoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public void SetStrength(EntityUid uid, ParticleAcceleratorPowerState strength, E
or ParticleAcceleratorPowerState.Level1
or ParticleAcceleratorPowerState.Level2 => LogImpact.Medium,
ParticleAcceleratorPowerState.Level3 => LogImpact.Extreme,
_ => throw new IndexOutOfRangeException(nameof(strength)),
};

_adminLogger.Add(LogType.Action, impact, $"{ToPrettyString(player):player} has set the strength of {ToPrettyString(uid)} to {strength}");
Expand Down
21 changes: 17 additions & 4 deletions Content.Server/Research/Systems/ResearchSystem.Console.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using Content.Server.Research.Components;
using Content.Shared.UserInterface;
using Content.Shared.Access.Components;
using Content.Shared.Emag.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Research.Components;
using Content.Shared.Research.Prototypes;

Expand Down Expand Up @@ -37,10 +39,20 @@ private void OnConsoleUnlock(EntityUid uid, ResearchConsoleComponent component,
if (!UnlockTechnology(uid, args.Id, act))
return;

var message = Loc.GetString("research-console-unlock-technology-radio-broadcast",
("technology", Loc.GetString(technologyPrototype.Name)),
("amount", technologyPrototype.Cost));
_radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false);
if (!HasComp<EmaggedComponent>(uid))
{
var getIdentityEvent = new TryGetIdentityShortInfoEvent(uid, act);
RaiseLocalEvent(getIdentityEvent);

var message = Loc.GetString(
"research-console-unlock-technology-radio-broadcast",
("technology", Loc.GetString(technologyPrototype.Name)),
("amount", technologyPrototype.Cost),
("approver", getIdentityEvent.Title ?? string.Empty)
);
_radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false);
}

SyncClientWithServer(uid);
UpdateConsoleInterface(uid, component);
}
Expand Down Expand Up @@ -87,4 +99,5 @@ private void OnConsoleDatabaseModified(EntityUid uid, ResearchConsoleComponent c
{
UpdateConsoleInterface(uid, component);
}

}
3 changes: 2 additions & 1 deletion Content.Server/StationEvents/Events/IonStormRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ private string GenerateLaw()
{
0 => threats,
1 => crew1,
2 => objects
2 => objects,
_ => throw new IndexOutOfRangeException(),
};
var crewAll = RobustRandom.Prob(0.5f) ? crew2 : Loc.GetString("ion-storm-crew");
var objectsThreats = RobustRandom.Prob(0.5f) ? objects : threats;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ public bool IsSkipped(StationRecordsFilter? filter, GeneralStationRecord someRec
&& IsFilterWithSomeCodeValue(someRecord.Fingerprint, filterLowerCaseValue),
StationRecordFilterType.DNA => someRecord.DNA != null
&& IsFilterWithSomeCodeValue(someRecord.DNA, filterLowerCaseValue),
_ => throw new IndexOutOfRangeException(nameof(filter.Type)),
};
}

Expand Down
12 changes: 7 additions & 5 deletions Content.Shared/Access/Systems/AccessReaderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
using Content.Shared.Inventory;
using Content.Shared.NameIdentifier;
using Content.Shared.PDA;
using Content.Shared.Silicons.Borgs.Components;
using Content.Shared.StationRecords;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Content.Shared.GameTicking;
using Content.Shared.IdentityManagement;
using Robust.Shared.Collections;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
Expand All @@ -26,7 +26,6 @@ public sealed class AccessReaderSystem : EntitySystem
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedGameTicker _gameTicker = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedIdCardSystem _idCardSystem = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedStationRecordsSystem _recordsSystem = default!;

Expand Down Expand Up @@ -402,9 +401,12 @@ public void LogAccess(Entity<AccessReaderComponent> ent, EntityUid accessor)

// TODO pass the ID card on IsAllowed() instead of using this expensive method
// Set name if the accessor has a card and that card has a name and allows itself to be recorded
if (_idCardSystem.TryFindIdCard(accessor, out var idCard)
&& idCard.Comp is { BypassLogging: false, FullName: not null })
name = idCard.Comp.FullName;
var getIdentityShortInfoEvent = new TryGetIdentityShortInfoEvent(ent, accessor, true);
RaiseLocalEvent(getIdentityShortInfoEvent);
if (getIdentityShortInfoEvent.Title != null)
{
name = getIdentityShortInfoEvent.Title;
}

LogAccess(ent, name ?? Loc.GetString("access-reader-unknown-id"));
}
Expand Down
Loading

0 comments on commit 99608f7

Please sign in to comment.