Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into upstream-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Morb0 committed Mar 13, 2024
2 parents 2eda294 + 5b72f3f commit 837a7f9
Show file tree
Hide file tree
Showing 78 changed files with 7,828 additions and 6,912 deletions.
3 changes: 2 additions & 1 deletion Content.Client/Chat/UI/SpeechBubble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ protected override Control BuildBubble(ChatMessage message, string speechStyleCl
var bubbleContent = new RichTextLabel
{
MaxWidth = SpeechMaxWidth,
Margin = new Thickness(2, 6, 2, 2)
Margin = new Thickness(2, 6, 2, 2),
StyleClasses = { "bubbleContent" }
};

//We'll be honest. *Yes* this is hacky. Doing this in a cleaner way would require a bottom-up refactor of how saycode handles sending chat messages. -Myr
Expand Down
8 changes: 8 additions & 0 deletions Content.Client/Stylesheets/StyleNano.cs
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,14 @@ public StyleNano(IResourceCache resCache) : base(resCache)
new StyleProperty(PanelContainer.StylePropertyPanel, whisperBox)
}),

new StyleRule(new SelectorChild(
new SelectorElement(typeof(PanelContainer), new[] {"speechBox", "whisperBox"}, null, null),
new SelectorElement(typeof(RichTextLabel), new[] {"bubbleContent"}, null, null)),
new[]
{
new StyleProperty("font", notoSansItalic12),
}),

new StyleRule(new SelectorChild(
new SelectorElement(typeof(PanelContainer), new[] {"speechBox", "emoteBox"}, null, null),
new SelectorElement(typeof(RichTextLabel), null, null, null)),
Expand Down
9 changes: 9 additions & 0 deletions Content.Client/Weapons/Ranged/Systems/GunSystem.Magazine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ protected override void InitializeMagazine()
{
base.InitializeMagazine();
SubscribeLocalEvent<MagazineAmmoProviderComponent, UpdateAmmoCounterEvent>(OnMagazineAmmoUpdate);
SubscribeLocalEvent<MagazineAmmoProviderComponent, AmmoCounterControlEvent>(OnMagazineControl);
}

private void OnMagazineAmmoUpdate(EntityUid uid, MagazineAmmoProviderComponent component, UpdateAmmoCounterEvent args)
Expand All @@ -26,4 +27,12 @@ private void OnMagazineAmmoUpdate(EntityUid uid, MagazineAmmoProviderComponent c

RaiseLocalEvent(ent.Value, args, false);
}

private void OnMagazineControl(EntityUid uid, MagazineAmmoProviderComponent component, AmmoCounterControlEvent args)
{
var ent = GetMagazineEntity(uid);
if (ent == null)
return;
RaiseLocalEvent(ent.Value, args, false);
}
}
35 changes: 25 additions & 10 deletions Content.Server/Administration/Systems/AdminVerbSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public sealed partial class AdminVerbSystem : EntitySystem
[Dependency] private readonly StationSystem _stations = default!;
[Dependency] private readonly StationSpawningSystem _spawning = default!;

private readonly Dictionary<ICommonSession, EditSolutionsEui> _openSolutionUis = new();
private readonly Dictionary<ICommonSession, List<EditSolutionsEui>> _openSolutionUis = new();

public override void Initialize()
{
Expand Down Expand Up @@ -486,10 +486,13 @@ private void AddDebugVerbs(GetVerbsEvent<Verb> args)
#region SolutionsEui
private void OnSolutionChanged(Entity<SolutionContainerManagerComponent> entity, ref SolutionContainerChangedEvent args)
{
foreach (var eui in _openSolutionUis.Values)
foreach (var list in _openSolutionUis.Values)
{
if (eui.Target == entity.Owner)
eui.StateDirty();
foreach (var eui in list)
{
if (eui.Target == entity.Owner)
eui.StateDirty();
}
}
}

Expand All @@ -498,21 +501,33 @@ public void OpenEditSolutionsEui(ICommonSession session, EntityUid uid)
if (session.AttachedEntity == null)
return;

if (_openSolutionUis.ContainsKey(session))
_openSolutionUis[session].Close();

var eui = _openSolutionUis[session] = new EditSolutionsEui(uid);
var eui = new EditSolutionsEui(uid);
_euiManager.OpenEui(eui, session);
eui.StateDirty();

if (!_openSolutionUis.ContainsKey(session)) {
_openSolutionUis[session] = new List<EditSolutionsEui>();
}

_openSolutionUis[session].Add(eui);
}

public void OnEditSolutionsEuiClosed(ICommonSession session)
public void OnEditSolutionsEuiClosed(ICommonSession session, EditSolutionsEui eui)
{
_openSolutionUis.Remove(session, out var eui);
_openSolutionUis[session].Remove(eui);
if (_openSolutionUis[session].Count == 0)
_openSolutionUis.Remove(session);
}

private void Reset(RoundRestartCleanupEvent ev)
{
foreach (var euis in _openSolutionUis.Values)
{
foreach (var eui in euis.ToList())
{
eui.Close();
}
}
_openSolutionUis.Clear();
}
#endregion
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Administration/UI/EditSolutionsEui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public override void Opened()
public override void Closed()
{
base.Closed();
_entityManager.System<AdminVerbSystem>().OnEditSolutionsEuiClosed(Player);
_entityManager.System<AdminVerbSystem>().OnEditSolutionsEuiClosed(Player, this);
}

public override EuiStateBase GetNewState()
Expand Down
10 changes: 8 additions & 2 deletions Content.Server/Audio/ServerGlobalSoundSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Server.Station.Systems;
using Content.Shared.Audio;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Console;
using Robust.Shared.Player;

Expand All @@ -10,6 +11,7 @@ public sealed class ServerGlobalSoundSystem : SharedGlobalSoundSystem
{
[Dependency] private readonly IConsoleHost _conHost = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;

public override void Shutdown()
{
Expand Down Expand Up @@ -49,10 +51,14 @@ public void StopStationEventMusic(EntityUid source, StationEventMusicType type)
}

public void DispatchStationEventMusic(EntityUid source, SoundSpecifier sound, StationEventMusicType type)
{
DispatchStationEventMusic(source, _audio.GetSound(sound), type);
}

public void DispatchStationEventMusic(EntityUid source, string sound, StationEventMusicType type)
{
var audio = AudioParams.Default.WithVolume(-8);
var soundFile = sound.GetSound();
var msg = new StationEventMusicEvent(soundFile, type, audio);
var msg = new StationEventMusicEvent(sound, type, audio);

var filter = GetStationAndPvs(source);
RaiseNetworkEvent(msg, filter);
Expand Down
16 changes: 14 additions & 2 deletions Content.Server/Chemistry/EntitySystems/InjectorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,21 @@ private void InjectDoAfter(Entity<InjectorComponent> injector, EntityUid target,
return;

var actualDelay = MathHelper.Max(injector.Comp.Delay, TimeSpan.FromSeconds(1));
float amountToInject;
if (injector.Comp.ToggleState == InjectorToggleMode.Draw)
{
// additional delay is based on actual volume left to draw in syringe when smaller than transfer amount
amountToInject = Math.Min(injector.Comp.TransferAmount.Float(), (solution.MaxVolume - solution.Volume).Float());
}
else
{
// additional delay is based on actual volume left to inject in syringe when smaller than transfer amount
amountToInject = Math.Min(injector.Comp.TransferAmount.Float(), solution.Volume.Float());
}

// Injections take 0.5 seconds longer per 5u of possible space/content
actualDelay += TimeSpan.FromSeconds(amountToInject / 10);

// Injections take 0.5 seconds longer per additional 5u
actualDelay += TimeSpan.FromSeconds(injector.Comp.TransferAmount.Float() / injector.Comp.Delay.TotalSeconds - 0.5f);

var isTarget = user != target;

Expand Down
3 changes: 3 additions & 0 deletions Content.Server/Communications/CommunicationsConsoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ private void OnBroadcastMessage(EntityUid uid, CommunicationsConsoleComponent co
};

_deviceNetworkSystem.QueuePacket(uid, null, payload, net.TransmitFrequency);

if (message.Session.AttachedEntity != null)
_adminLogger.Add(LogType.DeviceNetwork, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following broadcast: {message.Message:msg}");
}

private void OnCallShuttleMessage(EntityUid uid, CommunicationsConsoleComponent comp, CommunicationsConsoleCallEmergencyShuttleMessage message)
Expand Down
15 changes: 13 additions & 2 deletions Content.Server/Fax/FaxSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ private void OnFileButtonPressed(EntityUid uid, FaxMachineComponent component, F

private void OnCopyButtonPressed(EntityUid uid, FaxMachineComponent component, FaxCopyMessage args)
{
Copy(uid, component);
Copy(uid, component, args);
}

private void OnSendButtonPressed(EntityUid uid, FaxMachineComponent component, FaxSendMessage args)
Expand Down Expand Up @@ -416,13 +416,20 @@ public void PrintFile(EntityUid uid, FaxMachineComponent component, FaxFileMessa
component.SendTimeoutRemaining += component.SendTimeout;

UpdateUserInterface(uid, component);

if (args.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(args.Session.AttachedEntity.Value):actor} added print job to {ToPrettyString(uid):tool} with text: {args.Content}");
else
_adminLogger.Add(LogType.Action, LogImpact.Low,
$"Someone added print job to {ToPrettyString(uid):tool} with text: {args.Content}");
}

/// <summary>
/// Copies the paper in the fax. A timeout is set after copying,
/// which is shared by the send button.
/// </summary>
public void Copy(EntityUid uid, FaxMachineComponent? component = null)
public void Copy(EntityUid uid, FaxMachineComponent? component, FaxCopyMessage args)
{
if (!Resolve(uid, ref component))
return;
Expand All @@ -449,6 +456,10 @@ public void Copy(EntityUid uid, FaxMachineComponent? component = null)
// will start immediately.

UpdateUserInterface(uid, component);

if (args.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(args.Session.AttachedEntity.Value):actor} added copy job to {ToPrettyString(uid):tool} with text: {ToPrettyString(component.PaperSlot.Item):subject}");
}

/// <summary>
Expand Down
29 changes: 17 additions & 12 deletions Content.Server/Kitchen/EntitySystems/SharpSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Shared.Database;
using Content.Shared.Interaction;
using Content.Shared.Nutrition.Components;
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.Popups;
using Content.Shared.Storage;
using Content.Shared.Verbs;
Expand Down Expand Up @@ -34,39 +35,42 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<SharpComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<SharpComponent, AfterInteractEvent>(OnAfterInteract, before: new[] { typeof(UtensilSystem) });
SubscribeLocalEvent<SharpComponent, SharpDoAfterEvent>(OnDoAfter);

SubscribeLocalEvent<ButcherableComponent, GetVerbsEvent<InteractionVerb>>(OnGetInteractionVerbs);
}

private void OnAfterInteract(EntityUid uid, SharpComponent component, AfterInteractEvent args)
{
if (args.Handled)
return;

if (args.Target is null || !args.CanReach)
return;

TryStartButcherDoafter(uid, args.Target.Value, args.User);
args.Handled = TryStartButcherDoAfter(uid, args.Target.Value, args.User);
}

private void TryStartButcherDoafter(EntityUid knife, EntityUid target, EntityUid user)
private bool TryStartButcherDoAfter(EntityUid knife, EntityUid target, EntityUid user)
{
if (!TryComp<ButcherableComponent>(target, out var butcher))
return;
return false;

if (!TryComp<SharpComponent>(knife, out var sharp))
return;
return false;

if (TryComp<MobStateComponent>(target, out var mobState) && !_mobStateSystem.IsDead(target, mobState))
return false;

if (butcher.Type != ButcheringType.Knife)
if (butcher.Type != ButcheringType.Knife && target != user)
{
_popupSystem.PopupEntity(Loc.GetString("butcherable-different-tool", ("target", target)), knife, user);
return;
return true;
}

if (TryComp<MobStateComponent>(target, out var mobState) && !_mobStateSystem.IsDead(target, mobState))
return;

if (!sharp.Butchering.Add(target))
return;
return true;

var doAfter =
new DoAfterArgs(EntityManager, user, sharp.ButcherDelayModifier * butcher.ButcherDelay, new SharpDoAfterEvent(), knife, target: target, used: knife)
Expand All @@ -77,6 +81,7 @@ private void TryStartButcherDoafter(EntityUid knife, EntityUid target, EntityUid
NeedHand = true
};
_doAfterSystem.TryStartDoAfter(doAfter);
return true;
}

private void OnDoAfter(EntityUid uid, SharpComponent component, DoAfterEvent args)
Expand Down Expand Up @@ -161,7 +166,7 @@ private void OnGetInteractionVerbs(EntityUid uid, ButcherableComponent component
Act = () =>
{
if (!disabled)
TryStartButcherDoafter(args.Using!.Value, args.Target, args.User);
TryStartButcherDoAfter(args.Using!.Value, args.Target, args.User);
},
Message = message,
Disabled = disabled,
Expand Down
4 changes: 4 additions & 0 deletions Content.Server/Materials/MaterialReclaimerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
using Robust.Shared.Player;
using Robust.Shared.Utility;
using System.Linq;
using Content.Server.Administration.Logs;
using Content.Shared.Database;

namespace Content.Server.Materials;

Expand All @@ -35,6 +37,7 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
[Dependency] private readonly PuddleSystem _puddle = default!;
[Dependency] private readonly StackSystem _stack = default!;
[Dependency] private readonly SharedMindSystem _mind = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;

/// <inheritdoc/>
public override void Initialize()
Expand Down Expand Up @@ -154,6 +157,7 @@ public override void Reclaim(EntityUid uid,

if (CanGib(uid, item, component))
{
_adminLogger.Add(LogType.Gib, LogImpact.Extreme, $"{ToPrettyString(item):victim} was gibbed by {ToPrettyString(uid):entity} ");
SpawnChemicalsFromComposition(uid, item, completion, false, component, xform);
_body.GibBody(item, true);
_appearance.SetData(uid, RecyclerVisuals.Bloody, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed partial class BiomassReclaimerComponent : Component
/// <summary>
/// The interval for <see cref="RandomMessTimer"/>.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("randomMessInterval")]
[ViewVariables(VVAccess.ReadWrite), DataField]
public TimeSpan RandomMessInterval = TimeSpan.FromSeconds(5);

/// <summary>
Expand All @@ -28,9 +28,10 @@ public sealed partial class BiomassReclaimerComponent : Component
/// <summary>
/// Amount of biomass that the mob being processed will yield.
/// This is calculated from the YieldPerUnitMass.
/// Also stores non-integer leftovers.
/// </summary>
[ViewVariables]
public int CurrentExpectedYield = default;
public float CurrentExpectedYield = 0f;

/// <summary>
/// The reagent that will be spilled while processing a mob.
Expand All @@ -49,6 +50,18 @@ public sealed partial class BiomassReclaimerComponent : Component
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float YieldPerUnitMass = 0.4f;

/// <summary>
/// How many seconds to take to insert an entity per unit of its mass.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float BaseInsertionDelay = 0.1f;

/// <summary>
/// How much to multiply biomass yield from botany produce.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float ProduceYieldMultiplier = 0.25f;

/// <summary>
/// The time it takes to process a mob, per mass.
/// </summary>
Expand All @@ -58,7 +71,7 @@ public sealed partial class BiomassReclaimerComponent : Component
/// <summary>
/// Will this refuse to gib a living mob?
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("safetyEnabled")]
[ViewVariables(VVAccess.ReadWrite), DataField]
public bool SafetyEnabled = true;
}
}
Loading

0 comments on commit 837a7f9

Please sign in to comment.