Skip to content

Commit

Permalink
Merge pull request #443 from Rxup/upstream-sync
Browse files Browse the repository at this point in the history
Upstream sync
  • Loading branch information
Rxup authored Feb 1, 2024
2 parents 4928694 + 3c940a2 commit 7beff8c
Show file tree
Hide file tree
Showing 318 changed files with 5,208 additions and 317,751 deletions.
2 changes: 1 addition & 1 deletion Content.Benchmarks/MapLoadBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task Cleanup()
PoolManager.Shutdown();
}

public static readonly string[] MapsSource = { "Empty", "Box", "Aspid", "Bagel", "Dev", "CentComm", "Atlas", "Core", "TestTeg", "Saltern", "Packed", "Omega", "Cluster", "Gemini", "Reach", "Origin", "Meta", "Marathon", "Europa", "MeteorArena", "Fland", "Barratry" };
public static readonly string[] MapsSource = { "Empty", "Box", "Bagel", "Dev", "CentComm", "Atlas", "Core", "TestTeg", "Saltern", "Packed", "Omega", "Cluster", "Reach", "Origin", "Meta", "Marathon", "Europa", "MeteorArena", "Fland", "Barratry" };

[ParamsSource(nameof(MapsSource))]
public string Map;
Expand Down
8 changes: 8 additions & 0 deletions Content.Client/Atmos/EntitySystems/FirestarterSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Shared.Atmos.EntitySystems;

namespace Content.Client.Atmos.EntitySystems;

public sealed class FirestarterSystem : SharedFirestarterSystem
{

}
4 changes: 0 additions & 4 deletions Content.Client/Buckle/BuckleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Content.Shared.Buckle;
using Content.Shared.Buckle.Components;
using Content.Shared.Rotation;
using Content.Shared.Vehicle.Components;
using Robust.Client.GameObjects;

namespace Content.Client.Buckle;
Expand All @@ -26,9 +25,6 @@ private void OnBuckleAfterAutoHandleState(EntityUid uid, BuckleComponent compone
if (!TryComp<SpriteComponent>(uid, out var ownerSprite))
return;

if (HasComp<VehicleComponent>(component.LastEntityBuckledTo))
return;

// Adjust draw depth when the chair faces north so that the seat back is drawn over the player.
// Reset the draw depth when rotated in any other direction.
// TODO when ECSing, make this a visualizer
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Corvax/TTS/TTSSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void OnPlayTTS(PlayTTSEvent ev)
{
var sourceUid = GetEntity(ev.SourceUid.Value);
if(sourceUid.Valid)
_audio.PlayEntity(soundPath, Filter.Local(), sourceUid, false, AudioParams.Default); // recipient arg ignored on client
_audio.PlayEntity(soundPath, Filter.Local(), sourceUid, false, audioParams); // recipient arg ignored on client
}
else
{
Expand Down
19 changes: 17 additions & 2 deletions Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
using Content.Shared.FixedPoint;
using Content.Shared.IdentityManagement;
using Content.Shared.MedicalScanner;
using Content.Shared.Nutrition.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;

Expand Down Expand Up @@ -85,6 +87,19 @@ public void Populate(HealthAnalyzerScannedUserMessage msg)

DrawDiagnosticGroups(damageSortedGroups, damagePerType);

if (_entityManager.TryGetComponent(target, out HungerComponent? hunger)
&& hunger.StarvationDamage != null
&& hunger.CurrentThreshold <= HungerThreshold.Starving)
{
var box = new Control { Margin = new Thickness(0, 0, 0, 15) };

box.AddChild(CreateDiagnosticGroupTitle(
Loc.GetString("health-analyzer-window-malnutrition"),
"malnutrition"));

GroupsContainer.AddChild(box);
}

SetHeight = AnalyzerHeight;
SetWidth = AnalyzerWidth;
}
Expand Down Expand Up @@ -113,7 +128,7 @@ private void DrawDiagnosticGroups(
Orientation = BoxContainer.LayoutOrientation.Vertical,
};

groupContainer.AddChild(CreateDiagnosticGroupTitle(groupTitleText, damageGroupId, damageAmount.Int()));
groupContainer.AddChild(CreateDiagnosticGroupTitle(groupTitleText, damageGroupId));

GroupsContainer.AddChild(groupContainer);

Expand Down Expand Up @@ -166,7 +181,7 @@ private static Label CreateDiagnosticItemLabel(string text)
};
}

private BoxContainer CreateDiagnosticGroupTitle(string text, string id, int damageAmount)
private BoxContainer CreateDiagnosticGroupTitle(string text, string id)
{
var rootContainer = new BoxContainer
{
Expand Down
13 changes: 8 additions & 5 deletions Content.Client/Lathe/LatheSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@ private void OnAppearanceChange(EntityUid uid, LatheComponent component, ref App
return;

if (_appearance.TryGetData<bool>(uid, PowerDeviceVisuals.Powered, out var powered, args.Component) &&
args.Sprite.LayerMapTryGet(PowerDeviceVisualLayers.Powered, out _))
args.Sprite.LayerMapTryGet(PowerDeviceVisualLayers.Powered, out var powerLayer))
{
args.Sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered);
args.Sprite.LayerSetVisible(powerLayer, powered);
}

// Lathe specific stuff
if (_appearance.TryGetData<bool>(uid, LatheVisuals.IsRunning, out var isRunning, args.Component))
if (_appearance.TryGetData<bool>(uid, LatheVisuals.IsRunning, out var isRunning, args.Component) &&
args.Sprite.LayerMapTryGet(LatheVisualLayers.IsRunning, out var runningLayer) &&
component.RunningState != null &&
component.IdleState != null)
{
var state = isRunning ? component.RunningState : component.IdleState;
args.Sprite.LayerSetAnimationTime(LatheVisualLayers.IsRunning, 0f);
args.Sprite.LayerSetState(LatheVisualLayers.IsRunning, state);
args.Sprite.LayerSetAnimationTime(runningLayer, 0f);
args.Sprite.LayerSetState(runningLayer, state);
}
}

Expand Down
8 changes: 8 additions & 0 deletions Content.Client/Power/Generator/GeneratorWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ public void Update(PortableGeneratorComponentBuiState state)

private bool TryGetStartProgress(out float progress)
{
// Try to check progress of auto-revving first
if (_entityManager.TryGetComponent<ActiveGeneratorRevvingComponent>(_entity, out var activeGeneratorRevvingComponent) && _entityManager.TryGetComponent<PortableGeneratorComponent>(_entity, out var portableGeneratorComponent))
{
var calculatedProgress = activeGeneratorRevvingComponent.CurrentTime / portableGeneratorComponent.StartTime;
progress = (float) calculatedProgress;
return true;
}

var doAfterSystem = _entityManager.EntitySysManager.GetEntitySystem<DoAfterSystem>();
return doAfterSystem.TryFindActiveDoAfter<GeneratorStartedEvent>(_entity, out _, out _, out progress);
}
Expand Down
87 changes: 87 additions & 0 deletions Content.Client/Throwing/ThrownItemVisualizerSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using Content.Shared.Throwing;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Shared.Animations;

namespace Content.Client.Throwing;

/// <summary>
/// Handles animating thrown items.
/// </summary>
public sealed class ThrownItemVisualizerSystem : EntitySystem
{
[Dependency] private readonly AnimationPlayerSystem _anim = default!;

private const string AnimationKey = "thrown-item";

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ThrownItemComponent, AfterAutoHandleStateEvent>(OnAutoHandleState);
SubscribeLocalEvent<ThrownItemComponent, ComponentShutdown>(OnShutdown);
}

private void OnAutoHandleState(EntityUid uid, ThrownItemComponent component, ref AfterAutoHandleStateEvent args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;

var animationPlayer = EnsureComp<AnimationPlayerComponent>(uid);

if (_anim.HasRunningAnimation(uid, animationPlayer, AnimationKey))
return;

var anim = GetAnimation((uid, component, sprite));
if (anim == null)
return;

component.OriginalScale = sprite.Scale;
_anim.Play((uid, animationPlayer), anim, AnimationKey);
}

private void OnShutdown(EntityUid uid, ThrownItemComponent component, ComponentShutdown args)
{
if (!_anim.HasRunningAnimation(uid, AnimationKey))
return;

if (TryComp<SpriteComponent>(uid, out var sprite) && component.OriginalScale != null)
sprite.Scale = component.OriginalScale.Value;

_anim.Stop(uid, AnimationKey);
}

private static Animation? GetAnimation(Entity<ThrownItemComponent, SpriteComponent> ent)
{
if (ent.Comp1.LandTime - ent.Comp1.ThrownTime is not { } length)
return null;

if (length <= TimeSpan.Zero)
return null;

length += TimeSpan.FromSeconds(ThrowingSystem.FlyTime);
var scale = ent.Comp2.Scale;
var lenFloat = (float) length.TotalSeconds;

// TODO use like actual easings here
return new Animation
{
Length = length,
AnimationTracks =
{
new AnimationTrackComponentProperty
{
ComponentType = typeof(SpriteComponent),
Property = nameof(SpriteComponent.Scale),
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(scale, 0.0f),
new AnimationTrackProperty.KeyFrame(scale * 1.4f, lenFloat * 0.25f),
new AnimationTrackProperty.KeyFrame(scale, lenFloat * 0.75f)
},
InterpolationMode = AnimationInterpolationMode.Linear
}
}
};
}
}
4 changes: 2 additions & 2 deletions Content.Client/Tools/UI/WelderStatusControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public sealed class WelderStatusControl : Control
private readonly ItemToggleComponent? _toggleComponent;
private readonly RichTextLabel _label;

public WelderStatusControl(WelderComponent parent, EntityUid? uid = null)
public WelderStatusControl(Entity<WelderComponent> parent)
{
_parent = parent;
_entMan = IoCManager.Resolve<IEntityManager>();
if (_entMan.TryGetComponent<ItemToggleComponent>(uid, out var itemToggle))
if (_entMan.TryGetComponent<ItemToggleComponent>(parent, out var itemToggle))
_toggleComponent = itemToggle;
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
AddChild(_label);
Expand Down
80 changes: 0 additions & 80 deletions Content.Client/Vehicle/VehicleSystem.cs

This file was deleted.

5 changes: 4 additions & 1 deletion Content.IntegrationTests/Tests/GameRules/SecretStartsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ public async Task TestSecretStarts()

await server.WaitAssertion(() =>
{
gameTicker.StartGameRule("Secret");
// this mimics roundflow:
// rules added, then round starts
gameTicker.AddGameRule("Secret");
gameTicker.StartGamePresetRules();
});

// Wait three ticks for any random update loops that might happen
Expand Down
2 changes: 0 additions & 2 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public sealed class PostMapInitTest
"Fland",
"Meta",
"Packed",
"Aspid",
"Cluster",
"Omega",
"Bagel",
Expand All @@ -69,7 +68,6 @@ public sealed class PostMapInitTest
"Saltern",
"Core",
"Marathon",
"Gemini",
"MeteorArena",
"Atlas",
//start-backmen
Expand Down
Loading

0 comments on commit 7beff8c

Please sign in to comment.