Skip to content

Commit

Permalink
Merge branch 'master' into ntr-access
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepyyapril authored Jan 15, 2025
2 parents 7440465 + 76dfa63 commit 235317d
Show file tree
Hide file tree
Showing 68 changed files with 778 additions and 641 deletions.
46 changes: 46 additions & 0 deletions Content.Client/Movement/Systems/ClientSpriteMovementSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
using Robust.Client.GameObjects;
using Robust.Shared.Timing;

namespace Content.Client.Movement.Systems;

/// <summary>
/// Controls the switching of motion and standing still animation
/// </summary>
public sealed class ClientSpriteMovementSystem : SharedSpriteMovementSystem
{
[Dependency] private readonly IGameTiming _timing = default!;

private EntityQuery<SpriteComponent> _spriteQuery;

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

_spriteQuery = GetEntityQuery<SpriteComponent>();

SubscribeLocalEvent<SpriteMovementComponent, AfterAutoHandleStateEvent>(OnAfterAutoHandleState);
}

private void OnAfterAutoHandleState(Entity<SpriteMovementComponent> ent, ref AfterAutoHandleStateEvent args)
{
if (!_spriteQuery.TryGetComponent(ent, out var sprite))
return;

if (ent.Comp.IsMoving)
{
foreach (var (layer, state) in ent.Comp.MovementLayers)
{
sprite.LayerSetData(layer, state);
}
}
else
{
foreach (var (layer, state) in ent.Comp.NoMovementLayers)
{
sprite.LayerSetData(layer, state);
}
}
}
}
51 changes: 0 additions & 51 deletions Content.Client/Movement/Systems/SpriteMovementSystem.cs

This file was deleted.

42 changes: 21 additions & 21 deletions Content.Client/Physics/Controllers/MoverController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,57 +34,57 @@ public override void Initialize()
Subs.CVar(_config, CCVars.DefaultWalk, _ => RaiseNetworkEvent(new UpdateInputCVarsMessage()));
}

private void OnUpdatePredicted(EntityUid uid, InputMoverComponent component, ref UpdateIsPredictedEvent args)
private void OnUpdatePredicted(Entity<InputMoverComponent> entity, ref UpdateIsPredictedEvent args)
{
// Enable prediction if an entity is controlled by the player
if (uid == _playerManager.LocalEntity)
if (entity.Owner == _playerManager.LocalEntity)
args.IsPredicted = true;
}

private void OnUpdateRelayTargetPredicted(EntityUid uid, MovementRelayTargetComponent component, ref UpdateIsPredictedEvent args)
private void OnUpdateRelayTargetPredicted(Entity<MovementRelayTargetComponent> entity, ref UpdateIsPredictedEvent args)
{
if (component.Source == _playerManager.LocalEntity)
if (entity.Comp.Source == _playerManager.LocalEntity)
args.IsPredicted = true;
}

private void OnUpdatePullablePredicted(EntityUid uid, PullableComponent component, ref UpdateIsPredictedEvent args)
private void OnUpdatePullablePredicted(Entity<PullableComponent> entity, ref UpdateIsPredictedEvent args)
{
// Enable prediction if an entity is being pulled by the player.
// Disable prediction if an entity is being pulled by some non-player entity.

if (component.Puller == _playerManager.LocalEntity)
if (entity.Comp.Puller == _playerManager.LocalEntity)
args.IsPredicted = true;
else if (component.Puller != null)
else if (entity.Comp.Puller != null)
args.BlockPrediction = true;

// TODO recursive pulling checks?
// What if the entity is being pulled by a vehicle controlled by the player?
}

private void OnRelayPlayerAttached(EntityUid uid, RelayInputMoverComponent component, LocalPlayerAttachedEvent args)
private void OnRelayPlayerAttached(Entity<RelayInputMoverComponent> entity, ref LocalPlayerAttachedEvent args)
{
Physics.UpdateIsPredicted(uid);
Physics.UpdateIsPredicted(component.RelayEntity);
if (MoverQuery.TryGetComponent(component.RelayEntity, out var inputMover))
SetMoveInput(inputMover, MoveButtons.None);
Physics.UpdateIsPredicted(entity.Owner);
Physics.UpdateIsPredicted(entity.Comp.RelayEntity);
if (MoverQuery.TryGetComponent(entity.Comp.RelayEntity, out var inputMover))
SetMoveInput((entity.Owner, inputMover), MoveButtons.None);
}

private void OnRelayPlayerDetached(EntityUid uid, RelayInputMoverComponent component, LocalPlayerDetachedEvent args)
private void OnRelayPlayerDetached(Entity<RelayInputMoverComponent> entity, ref LocalPlayerDetachedEvent args)
{
Physics.UpdateIsPredicted(uid);
Physics.UpdateIsPredicted(component.RelayEntity);
if (MoverQuery.TryGetComponent(component.RelayEntity, out var inputMover))
SetMoveInput(inputMover, MoveButtons.None);
Physics.UpdateIsPredicted(entity.Owner);
Physics.UpdateIsPredicted(entity.Comp.RelayEntity);
if (MoverQuery.TryGetComponent(entity.Comp.RelayEntity, out var inputMover))
SetMoveInput((entity.Owner, inputMover), MoveButtons.None);
}

private void OnPlayerAttached(EntityUid uid, InputMoverComponent component, LocalPlayerAttachedEvent args)
private void OnPlayerAttached(Entity<InputMoverComponent> entity, ref LocalPlayerAttachedEvent args)
{
SetMoveInput(component, MoveButtons.None);
SetMoveInput(entity, MoveButtons.None);
}

private void OnPlayerDetached(EntityUid uid, InputMoverComponent component, LocalPlayerDetachedEvent args)
private void OnPlayerDetached(Entity<InputMoverComponent> entity, ref LocalPlayerDetachedEvent args)
{
SetMoveInput(component, MoveButtons.None);
SetMoveInput(entity, MoveButtons.None);
}

public override void UpdateBeforeSolve(bool prediction, float frameTime)
Expand Down
8 changes: 5 additions & 3 deletions Content.Client/Wires/UI/WiresMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ public WiresMenu()
(_statusContainer = new GridContainer
{
Margin = new Thickness(8, 4),
// TODO: automatically change columns count.
Columns = 3
Rows = 2
})
}
}
Expand All @@ -227,7 +226,8 @@ public WiresMenu()
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
CloseButton.OnPressed += _ => Close();
SetSize = new Vector2(320, 200);
SetHeight = 200;
MinWidth = 320;
}


Expand Down Expand Up @@ -503,6 +503,8 @@ private sealed class StatusLight : Control

public StatusLight(StatusLightData data, IResourceCache resourceCache)
{
HorizontalAlignment = HAlignment.Right;

var hsv = Color.ToHsv(data.Color);
hsv.Z /= 2;
var dimColor = Color.FromHsv(hsv);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,19 @@ private void OnPowerUsed(EntityUid uid, PsionicComponent psionic, AssayPowerActi
return;

var ev = new AssayDoAfterEvent(_gameTiming.CurTime, args.FontSize, args.FontColor);
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.Performer, args.UseDelay - TimeSpan.FromSeconds(psionic.CurrentAmplification), ev, args.Performer, args.Target, args.Performer)
var doAfterArgs = new DoAfterArgs(EntityManager, args.Performer, args.UseDelay - TimeSpan.FromSeconds(psionic.CurrentAmplification), ev, args.Performer, args.Target, args.Performer)
{
BlockDuplicate = true,
BreakOnMove = true,
BreakOnDamage = true,
}, out var doAfterId);
};

if (!_doAfterSystem.TryStartDoAfter(doAfterArgs, out var doAfterId))
return;

psionic.DoAfter = doAfterId;

_popups.PopupEntity(Loc.GetString(args.PopupTarget, ("entity", args.Target)), args.Performer, PopupType.Medium);

_audioSystem.PlayPvs(args.SoundUse, args.Performer, AudioParams.Default.WithVolume(8f).WithMaxDistance(1.5f).WithRolloffFactor(3.5f));
_psionics.LogPowerUsed(args.Performer, args.PowerName, args.MinGlimmer, args.MaxGlimmer);
args.Handled = true;
Expand Down
2 changes: 0 additions & 2 deletions Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public sealed partial class AtmosphereSystem
public bool MonstermosDepressurization { get; private set; }
public bool MonstermosRipTiles { get; private set; }
public float MonstermosRipTilesMinimumPressure { get; private set; }
public float MonstermosRipTilesPressureOffset { get; private set; }
public bool GridImpulse { get; private set; }
public float SpacingEscapeRatio { get; private set; }
public float SpacingMinGas { get; private set; }
Expand Down Expand Up @@ -54,7 +53,6 @@ private void InitializeCVars()
Subs.CVar(_cfg, CCVars.MonstermosDepressurization, value => MonstermosDepressurization = value, true);
Subs.CVar(_cfg, CCVars.MonstermosRipTiles, value => MonstermosRipTiles = value, true);
Subs.CVar(_cfg, CCVars.MonstermosRipTilesMinimumPressure, value => MonstermosRipTilesMinimumPressure = value, true);
Subs.CVar(_cfg, CCVars.MonstermosRipTilesPressureOffset, value => MonstermosRipTilesPressureOffset = value, true);
Subs.CVar(_cfg, CCVars.AtmosGridImpulse, value => GridImpulse = value, true);
Subs.CVar(_cfg, CCVars.AtmosSpacingEscapeRatio, value => SpacingEscapeRatio = value, true);
Subs.CVar(_cfg, CCVars.AtmosSpacingMinGas, value => SpacingMinGas = value, true);
Expand Down
Loading

0 comments on commit 235317d

Please sign in to comment.