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
# Conflicts:
#	Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml
#	Resources/Textures/Objects/Devices/nuke.rsi/meta.json
#	Resources/Textures/Objects/Misc/Lights/lamp.rsi/meta.json
  • Loading branch information
Morb0 committed Dec 25, 2023
2 parents f9e99fa + 7b46390 commit 918f543
Show file tree
Hide file tree
Showing 242 changed files with 4,007 additions and 1,230 deletions.
6 changes: 6 additions & 0 deletions Content.Client/Fax/UI/FaxBoundUi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ protected override void Open()
_window.OpenCentered();

_window.OnClose += Close;
_window.CopyButtonPressed += OnCopyButtonPressed;
_window.SendButtonPressed += OnSendButtonPressed;
_window.RefreshButtonPressed += OnRefreshButtonPressed;
_window.PeerSelected += OnPeerSelected;
Expand All @@ -32,6 +33,11 @@ private void OnSendButtonPressed()
SendMessage(new FaxSendMessage());
}

private void OnCopyButtonPressed()
{
SendMessage(new FaxCopyMessage());
}

private void OnRefreshButtonPressed()
{
SendMessage(new FaxRefreshMessage());
Expand Down
4 changes: 4 additions & 0 deletions Content.Client/Fax/UI/FaxWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
</BoxContainer>
<Control HorizontalExpand="True" MinHeight="20" />
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Button Name="CopyButton"
Text="{Loc 'fax-machine-ui-copy-button'}"
HorizontalExpand="False"
Disabled="True" />
<Button Name="SendButton"
Text="{Loc 'fax-machine-ui-send-button'}"
HorizontalExpand="True"
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Fax/UI/FaxWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Content.Client.Fax.UI;
[GenerateTypedNameReferences]
public sealed partial class FaxWindow : DefaultWindow
{
public event Action? CopyButtonPressed;
public event Action? SendButtonPressed;
public event Action? RefreshButtonPressed;
public event Action<string>? PeerSelected;
Expand All @@ -17,6 +18,7 @@ public FaxWindow()
{
RobustXamlLoader.Load(this);

CopyButton.OnPressed += _ => CopyButtonPressed?.Invoke();
SendButton.OnPressed += _ => SendButtonPressed?.Invoke();
RefreshButton.OnPressed += _ => RefreshButtonPressed?.Invoke();
PeerSelector.OnItemSelected += args =>
Expand All @@ -25,6 +27,7 @@ public FaxWindow()

public void UpdateState(FaxUiState state)
{
CopyButton.Disabled = !state.CanCopy;
SendButton.Disabled = !state.CanSend;
FromLabel.Text = state.DeviceName;

Expand Down
14 changes: 14 additions & 0 deletions Content.Client/Holiday/HolidayRsiSwapComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Content.Client.Holiday;

/// <summary>
/// This is used for a component that swaps an entity's RSI based on HolidayVisuals
/// </summary>
[RegisterComponent]
public sealed partial class HolidayRsiSwapComponent : Component
{
/// <summary>
/// A dictionary of arbitrary visual keys to an rsi to swap the sprite to.
/// </summary>
[DataField]
public Dictionary<string, string> Sprite = new();
}
34 changes: 34 additions & 0 deletions Content.Client/Holiday/HolidaySystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Content.Shared.Holiday;
using Content.Shared.Item;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Serialization.TypeSerializers.Implementations;

namespace Content.Client.Holiday;

public sealed class HolidaySystem : EntitySystem
{
[Dependency] private readonly IResourceCache _rescache = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;

/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<HolidayRsiSwapComponent, AppearanceChangeEvent>(OnAppearanceChange);
}

private void OnAppearanceChange(Entity<HolidayRsiSwapComponent> ent, ref AppearanceChangeEvent args)
{
if (!_appearance.TryGetData<string>(ent, HolidayVisuals.Holiday, out var data, args.Component))
return;

var comp = ent.Comp;
if (!comp.Sprite.TryGetValue(data, out var rsistring) || args.Sprite == null)
return;

var path = SpriteSpecifierSerializer.TextureRoot / rsistring;
if (_rescache.TryGetResource(path, out RSIResource? rsi))
args.Sprite.BaseRSI = rsi.RSI;
}
}
51 changes: 51 additions & 0 deletions Content.Client/Movement/Systems/SpriteMovementSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Events;
using Content.Shared.Movement.Systems;
using Robust.Client.GameObjects;
using Robust.Shared.Timing;

namespace Content.Client.Movement.Systems;

/// <summary>
/// Handles setting sprite states based on whether an entity has movement input.
/// </summary>
public sealed class SpriteMovementSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;

private EntityQuery<SpriteComponent> _spriteQuery;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SpriteMovementComponent, MoveInputEvent>(OnSpriteMoveInput);
_spriteQuery = GetEntityQuery<SpriteComponent>();
}

private void OnSpriteMoveInput(EntityUid uid, SpriteMovementComponent component, ref MoveInputEvent args)
{
if (!_timing.IsFirstTimePredicted)
return;

var oldMoving = SharedMoverController.GetNormalizedMovement(args.OldMovement) != MoveButtons.None;
var moving = SharedMoverController.GetNormalizedMovement(args.Component.HeldMoveButtons) != MoveButtons.None;

if (oldMoving == moving || !_spriteQuery.TryGetComponent(uid, out var sprite))
return;

if (moving)
{
foreach (var (layer, state) in component.MovementLayers)
{
sprite.LayerSetData(layer, state);
}
}
else
{
foreach (var (layer, state) in component.NoMovementLayers)
{
sprite.LayerSetData(layer, state);
}
}
}
}
18 changes: 11 additions & 7 deletions Content.IntegrationTests/Tests/CargoTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Content.Server.Cargo.Components;
Expand All @@ -6,14 +7,19 @@
using Content.Shared.Stacks;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;

namespace Content.IntegrationTests.Tests;

[TestFixture]
public sealed class CargoTest
{
public static HashSet<ProtoId<CargoProductPrototype>> Ignored = new ()
{
// This is ignored because it is explicitly intended to be able to sell for more than it costs.
new("FunCrateGambling")
};

[Test]
public async Task NoCargoOrderArbitrage()
{
Expand All @@ -23,27 +29,25 @@ public async Task NoCargoOrderArbitrage()
var testMap = await pair.CreateTestMap();

var entManager = server.ResolveDependency<IEntityManager>();
var mapManager = server.ResolveDependency<IMapManager>();
var protoManager = server.ResolveDependency<IPrototypeManager>();
var pricing = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<PricingSystem>();

await server.WaitAssertion(() =>
{
var mapId = testMap.MapId;

Assert.Multiple(() =>
{
foreach (var proto in protoManager.EnumeratePrototypes<CargoProductPrototype>())
{
var ent = entManager.SpawnEntity(proto.Product, new MapCoordinates(Vector2.Zero, mapId));
if (Ignored.Contains(proto.ID))
continue;

var ent = entManager.SpawnEntity(proto.Product, testMap.MapCoords);
var price = pricing.GetPrice(ent);

Assert.That(price, Is.AtMost(proto.PointCost), $"Found arbitrage on {proto.ID} cargo product! Cost is {proto.PointCost} but sell is {price}!");
entManager.DeleteEntity(ent);
}
});

mapManager.DeleteMap(mapId);
});

await pair.CleanReturnAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private void AddAntagVerbs(GetVerbsEvent<Verb> args)
if (!_minds.TryGetSession(targetMindComp.Mind, out var session))
return;

_thief.MakeThief(session);
_thief.MakeThief(session, false); //Midround add pacific is bad
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-verb-make-thief"),
Expand Down
26 changes: 26 additions & 0 deletions Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Content.Server.Storage.EntitySystems;
using Content.Server.Tabletop;
using Content.Server.Tabletop.Components;
using Content.Server.Terminator.Systems;
using Content.Shared.Administration;
using Content.Shared.Administration.Components;
using Content.Shared.Body.Components;
Expand All @@ -30,6 +31,7 @@
using Content.Shared.Electrocution;
using Content.Shared.Interaction.Components;
using Content.Shared.Inventory;
using Content.Shared.Mind.Components;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
Expand Down Expand Up @@ -72,6 +74,7 @@ public sealed partial class AdminVerbSystem
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly TabletopSystem _tabletopSystem = default!;
[Dependency] private readonly TerminatorSystem _terminator = default!;
[Dependency] private readonly VomitSystem _vomitSystem = default!;
[Dependency] private readonly WeldableSystem _weldableSystem = default!;
[Dependency] private readonly SharedContentEyeSystem _eyeSystem = default!;
Expand Down Expand Up @@ -793,6 +796,7 @@ private void AddSmiteVerbs(GetVerbsEvent<Verb> args)
Message = Loc.GetString("admin-smite-super-speed-description"),
};
args.Verbs.Add(superSpeed);

//Bonk
Verb superBonkLite = new()
{
Expand Down Expand Up @@ -820,5 +824,27 @@ private void AddSmiteVerbs(GetVerbsEvent<Verb> args)
Impact = LogImpact.Extreme,
};
args.Verbs.Add(superBonk);

Verb terminate = new()
{
Text = "Terminate",
Category = VerbCategory.Smite,
Icon = new SpriteSpecifier.Rsi(new ("Mobs/Species/Terminator/parts.rsi"), "skull_icon"),
Act = () =>
{
if (!TryComp<MindContainerComponent>(args.Target, out var mindContainer) || mindContainer.Mind == null)
return;

var coords = Transform(args.Target).Coordinates;
var mindId = mindContainer.Mind.Value;
_terminator.CreateSpawner(coords, mindId);

_popupSystem.PopupEntity(Loc.GetString("admin-smite-terminate-prompt"), args.Target,
args.Target, PopupType.LargeCaution);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-smite-terminate-description")
};
args.Verbs.Add(terminate);
}
}
12 changes: 7 additions & 5 deletions Content.Server/Administration/Systems/BwoinkSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.Json;
Expand Down Expand Up @@ -70,7 +70,7 @@ public override void Initialize()
_config.OnValueChanged(CVars.GameHostName, OnServerNameChanged, true);
_config.OnValueChanged(CCVars.AdminAhelpOverrideClientName, OnOverrideChanged, true);
_sawmill = IoCManager.Resolve<ILogManager>().GetSawmill("AHELP");
_maxAdditionalChars = GenerateAHelpMessage("", "", true).Length;
_maxAdditionalChars = GenerateAHelpMessage("", "", true, _timing.CurTime.ToString("hh\\:mm\\:ss"), _gameTicker.RunLevel).Length;
_playerManager.PlayerStatusChanged += OnPlayerStatusChanged;

SubscribeLocalEvent<GameRunLevelChangedEvent>(OnGameRunLevelChanged);
Expand Down Expand Up @@ -471,7 +471,7 @@ protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySes
{
str = str[..(DescriptionMax - _maxAdditionalChars - unameLength)];
}
_messageQueues[msg.UserId].Enqueue(GenerateAHelpMessage(senderSession.Name, str, !personalChannel, admins.Count == 0));
_messageQueues[msg.UserId].Enqueue(GenerateAHelpMessage(senderSession.Name, str, !personalChannel, _timing.CurTime.ToString("hh\\:mm\\:ss"), _gameTicker.RunLevel, admins.Count == 0));
}

if (admins.Count != 0 || sendsWebhook)
Expand All @@ -492,17 +492,19 @@ private IList<INetChannel> GetTargetAdmins()
.ToList();
}

private static string GenerateAHelpMessage(string username, string message, bool admin, bool noReceivers = false)
private static string GenerateAHelpMessage(string username, string message, bool admin, string roundTime, GameRunLevel roundState, bool noReceivers = false)
{
var stringbuilder = new StringBuilder();

if (admin)
stringbuilder.Append(":outbox_tray:");
else if (noReceivers)
stringbuilder.Append(":sos:");
else
stringbuilder.Append(":inbox_tray:");

if(roundTime != string.Empty && roundState == GameRunLevel.InRound)
stringbuilder.Append($" **{roundTime}**");
stringbuilder.Append($" **{username}:** ");
stringbuilder.Append(message);
return stringbuilder.ToString();
Expand Down
3 changes: 1 addition & 2 deletions Content.Server/Atmos/EntitySystems/AtmosphereSystem.Gases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace Content.Server.Atmos.EntitySystems
public sealed partial class AtmosphereSystem
{
[Dependency] private readonly IPrototypeManager _protoMan = default!;
[Dependency] private readonly GenericGasReactionSystem _reaction = default!;

private GasReactionPrototype[] _gasReactions = Array.Empty<GasReactionPrototype>();
private float[] _gasSpecificHeats = new float[Atmospherics.TotalNumberOfGases];
Expand Down Expand Up @@ -347,7 +346,7 @@ public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder)
break;
}

return _reaction.ReactAll(GasReactions, mixture, holder);
return reaction;
}

public enum GasCompareResult
Expand Down
Loading

0 comments on commit 918f543

Please sign in to comment.