Skip to content

Commit

Permalink
Merge branch 'master' into ammonation
Browse files Browse the repository at this point in the history
  • Loading branch information
nomad0260 committed Feb 6, 2025
2 parents 75deac9 + da07bd3 commit 225c21f
Show file tree
Hide file tree
Showing 585 changed files with 2,865 additions and 2,362 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Atmos/UI/SpaceHeaterWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
MinSize="280 160" Title="Temperature Control Unit">
MinSize="280 160" Title="{Loc comp-space-heater-ui-title}">

<BoxContainer Name="VboxContainer" Orientation="Vertical" Margin="5 5 5 5" SeparationOverride="10">

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Clickable/ClickMapManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal sealed class ClickMapManager : IClickMapManager, IPostInjectInit
"/Textures/Logo",
};

private const float Threshold = 0.25f;
private const float Threshold = 0.1f;
private const int ClickRadius = 2;

[Dependency] private readonly IResourceCache _resourceCache = default!;
Expand Down
24 changes: 22 additions & 2 deletions Content.Client/Ghost/GhostSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public sealed class GhostSystem : SharedGhostSystem
[Dependency] private readonly IClientConsoleHost _console = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly PointLightSystem _pointLightSystem = default!;
[Dependency] private readonly ContentEyeSystem _contentEye = default!;

public int AvailableGhostRoleCount { get; private set; }
Expand Down Expand Up @@ -79,8 +80,27 @@ private void OnToggleLighting(EntityUid uid, EyeComponent component, ToggleLight
if (args.Handled)
return;

Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup"), args.Performer);
_contentEye.RequestToggleLight(uid, component);
TryComp<PointLightComponent>(uid, out var light);

if (!component.DrawLight)
{
// normal lighting
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup-normal"), args.Performer);
_contentEye.RequestEye(component.DrawFov, true);
}
else if (!light?.Enabled ?? false) // skip this option if we have no PointLightComponent
{
// enable personal light
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup-personal-light"), args.Performer);
_pointLightSystem.SetEnabled(uid, true, light);
}
else
{
// fullbright mode
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup-fullbright"), args.Performer);
_contentEye.RequestEye(component.DrawFov, false);
_pointLightSystem.SetEnabled(uid, false, light);
}
args.Handled = true;
}

Expand Down
54 changes: 7 additions & 47 deletions Content.Client/Orbit/OrbitVisualsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
using Robust.Client.GameObjects;
using Robust.Shared.Animations;
using Robust.Shared.Random;
using Robust.Shared.Timing;

namespace Content.Client.Orbit;

public sealed class OrbitVisualsSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly AnimationPlayerSystem _animations = default!;
[Dependency] private readonly IGameTiming _timing = default!;

private readonly string _orbitAnimationKey = "orbiting";
private readonly string _orbitStopKey = "orbiting_stop";

public override void Initialize()
Expand All @@ -21,11 +22,11 @@ public override void Initialize()

SubscribeLocalEvent<OrbitVisualsComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<OrbitVisualsComponent, ComponentRemove>(OnComponentRemove);
SubscribeLocalEvent<OrbitVisualsComponent, AnimationCompletedEvent>(OnAnimationCompleted);
}

private void OnComponentInit(EntityUid uid, OrbitVisualsComponent component, ComponentInit args)
{
_robustRandom.SetSeed((int)_timing.CurTime.TotalMilliseconds);
component.OrbitDistance =
_robustRandom.NextFloat(0.75f * component.OrbitDistance, 1.25f * component.OrbitDistance);

Expand All @@ -38,15 +39,10 @@ private void OnComponentInit(EntityUid uid, OrbitVisualsComponent component, Com
}

var animationPlayer = EnsureComp<AnimationPlayerComponent>(uid);
if (_animations.HasRunningAnimation(uid, animationPlayer, _orbitAnimationKey))
return;

if (_animations.HasRunningAnimation(uid, animationPlayer, _orbitStopKey))
{
_animations.Stop(uid, animationPlayer, _orbitStopKey);
_animations.Stop((uid, animationPlayer), _orbitStopKey);
}

_animations.Play(uid, animationPlayer, GetOrbitAnimation(component), _orbitAnimationKey);
}

private void OnComponentRemove(EntityUid uid, OrbitVisualsComponent component, ComponentRemove args)
Expand All @@ -57,14 +53,9 @@ private void OnComponentRemove(EntityUid uid, OrbitVisualsComponent component, C
sprite.EnableDirectionOverride = false;

var animationPlayer = EnsureComp<AnimationPlayerComponent>(uid);
if (_animations.HasRunningAnimation(uid, animationPlayer, _orbitAnimationKey))
{
_animations.Stop(uid, animationPlayer, _orbitAnimationKey);
}

if (!_animations.HasRunningAnimation(uid, animationPlayer, _orbitStopKey))
{
_animations.Play(uid, animationPlayer, GetStopAnimation(component, sprite), _orbitStopKey);
_animations.Play((uid, animationPlayer), GetStopAnimation(component, sprite), _orbitStopKey);
}
}

Expand All @@ -74,46 +65,15 @@ public override void FrameUpdate(float frameTime)

foreach (var (orbit, sprite) in EntityManager.EntityQuery<OrbitVisualsComponent, SpriteComponent>())
{
var angle = new Angle(Math.PI * 2 * orbit.Orbit);
var progress = (float)(_timing.CurTime.TotalSeconds / orbit.OrbitLength) % 1;
var angle = new Angle(Math.PI * 2 * progress);
var vec = angle.RotateVec(new Vector2(orbit.OrbitDistance, 0));

sprite.Rotation = angle;
sprite.Offset = vec;
}
}

private void OnAnimationCompleted(EntityUid uid, OrbitVisualsComponent component, AnimationCompletedEvent args)
{
if (args.Key == _orbitAnimationKey && TryComp(uid, out AnimationPlayerComponent? animationPlayer))
{
_animations.Play(uid, animationPlayer, GetOrbitAnimation(component), _orbitAnimationKey);
}
}

private Animation GetOrbitAnimation(OrbitVisualsComponent component)
{
var length = component.OrbitLength;

return new Animation()
{
Length = TimeSpan.FromSeconds(length),
AnimationTracks =
{
new AnimationTrackComponentProperty()
{
ComponentType = typeof(OrbitVisualsComponent),
Property = nameof(OrbitVisualsComponent.Orbit),
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(0.0f, 0f),
new AnimationTrackProperty.KeyFrame(1.0f, length),
},
InterpolationMode = AnimationInterpolationMode.Linear
}
}
};
}

private Animation GetStopAnimation(OrbitVisualsComponent component, SpriteComponent sprite)
{
var length = component.OrbitStopLength;
Expand Down
65 changes: 12 additions & 53 deletions Content.Client/Storage/StorageBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,80 +1,39 @@
using Content.Client.UserInterface.Systems.Storage;
using Content.Client.UserInterface.Systems.Storage.Controls;
using Content.Client.Storage.Systems;
using Content.Shared.Storage;
using JetBrains.Annotations;
using Robust.Client.UserInterface;

namespace Content.Client.Storage;

[UsedImplicitly]
public sealed class StorageBoundUserInterface : BoundUserInterface
{
private StorageWindow? _window;
[Dependency] private readonly IEntityManager _entManager = default!;

private readonly StorageSystem _storage;

[Obsolete] public override bool DeferredClose => false;

public StorageBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
_storage = _entManager.System<StorageSystem>();
}

protected override void Open()
{
base.Open();

_window = IoCManager.Resolve<IUserInterfaceManager>()
.GetUIController<StorageUIController>()
.CreateStorageWindow(Owner);

if (EntMan.TryGetComponent(Owner, out StorageComponent? storage))
{
_window.UpdateContainer((Owner, storage));
}

_window.OnClose += Close;
_window.FlagDirty();
}

public void Refresh()
{
_window?.FlagDirty();
}

public void Reclaim()
{
if (_window == null)
return;

_window.OnClose -= Close;
_window.Orphan();
_window = null;
if (_entManager.TryGetComponent<StorageComponent>(Owner, out var comp))
_storage.OpenStorageWindow((Owner, comp));
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);

Reclaim();
}

public void Hide()
{
if (_window == null)
return;

_window.Visible = false;
}

public void Show()
{
if (_window == null)
if (!disposing)
return;

_window.Visible = true;
}

public void ReOpen()
{
_window?.Orphan();
_window = null;
Open();
_storage.CloseStorageWindow(Owner);
}
}

Loading

0 comments on commit 225c21f

Please sign in to comment.