Misc changes from replay branch (#12581)

This commit is contained in:
Leon Friedrich
2022-11-15 19:34:47 +13:00
committed by GitHub
parent a2183fc223
commit 94011ca2b1
12 changed files with 21 additions and 12 deletions

View File

@@ -32,6 +32,7 @@ public sealed class EyeLerpingSystem : EntitySystem
UpdatesAfter.Add(typeof(TransformSystem)); UpdatesAfter.Add(typeof(TransformSystem));
UpdatesAfter.Add(typeof(PhysicsSystem)); UpdatesAfter.Add(typeof(PhysicsSystem));
UpdatesBefore.Add(typeof(EyeUpdateSystem)); UpdatesBefore.Add(typeof(EyeUpdateSystem));
UpdatesOutsidePrediction = true;
} }
private void OnEyeStartup(EntityUid uid, EyeComponent component, ComponentStartup args) private void OnEyeStartup(EntityUid uid, EyeComponent component, ComponentStartup args)

View File

@@ -265,7 +265,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
instrument.SequenceStartTick = midiEv.MidiEvent.Min(x => x.Tick) - 1; instrument.SequenceStartTick = midiEv.MidiEvent.Min(x => x.Tick) - 1;
} }
var sqrtLag = MathF.Sqrt(_netManager.ServerChannel!.Ping / 1000f); var sqrtLag = MathF.Sqrt((_netManager.ServerChannel?.Ping ?? 0)/ 1000f);
var delay = (uint) (renderer.SequencerTimeScale * (.2 + sqrtLag)); var delay = (uint) (renderer.SequencerTimeScale * (.2 + sqrtLag));
var delta = delay - instrument.SequenceStartTick; var delta = delay - instrument.SequenceStartTick;

View File

@@ -151,7 +151,7 @@ namespace Content.Client.Light
private void ResetOriginalColors(EntityUid uid, RgbLightControllerComponent? rgb = null, PointLightComponent? light = null, SpriteComponent? sprite = null) private void ResetOriginalColors(EntityUid uid, RgbLightControllerComponent? rgb = null, PointLightComponent? light = null, SpriteComponent? sprite = null)
{ {
if (!Resolve(uid, ref rgb, ref sprite, ref light)) if (!Resolve(uid, ref rgb, ref sprite, ref light, false))
return; return;
light.Color = rgb.OriginalLightColor; light.Color = rgb.OriginalLightColor;

View File

@@ -110,7 +110,7 @@ public sealed class InteractionOutlineSystem : EntitySystem
// Potentially change someday? who knows. // Potentially change someday? who knows.
var currentState = _stateManager.CurrentState; var currentState = _stateManager.CurrentState;
if (currentState is not GameplayState screen) return; if (currentState is not GameplayStateBase screen) return;
EntityUid? entityToClick = null; EntityUid? entityToClick = null;
var renderScale = 1; var renderScale = 1;

View File

@@ -311,11 +311,11 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
if (_window != null) if (_window != null)
{ {
_window.OnOpen += OnWindowOpened; _window.OnOpen -= OnWindowOpened;
_window.OnClose += OnWindowClosed; _window.OnClose -= OnWindowClosed;
_window.ClearButton.OnPressed += OnClearPressed; _window.ClearButton.OnPressed -= OnClearPressed;
_window.SearchBar.OnTextChanged += OnSearchChanged; _window.SearchBar.OnTextChanged -= OnSearchChanged;
_window.FilterButton.OnItemSelected += OnFilterSelected; _window.FilterButton.OnItemSelected -= OnFilterSelected;
_window.Dispose(); _window.Dispose();
_window = null; _window = null;

View File

@@ -155,7 +155,7 @@ public sealed class CharacterUIController : UIController, IOnStateEntered<Gamepl
private void CloseWindow() private void CloseWindow()
{ {
_window!.Close(); _window?.Close();
} }
private void ToggleWindow() private void ToggleWindow()

View File

@@ -40,18 +40,21 @@ namespace Content.Server.UserInterface
/// This should probably be true for most machines & computers, but there will still be UIs that represent a /// This should probably be true for most machines & computers, but there will still be UIs that represent a
/// more generic interaction / configuration that might not require hands. /// more generic interaction / configuration that might not require hands.
/// </remarks> /// </remarks>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("requireHands")] [DataField("requireHands")]
public bool RequireHands = true; public bool RequireHands = true;
/// <summary> /// <summary>
/// Whether spectators (non-admin ghosts) should be allowed to view this UI. /// Whether spectators (non-admin ghosts) should be allowed to view this UI.
/// </summary> /// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("allowSpectator")] [DataField("allowSpectator")]
public bool AllowSpectator = true; public bool AllowSpectator = true;
/// <summary> /// <summary>
/// Whether the UI should close when the item is deselected due to a hand swap or drop /// Whether the UI should close when the item is deselected due to a hand swap or drop
/// </summary> /// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("closeOnHandDeselect")] [DataField("closeOnHandDeselect")]
public bool CloseOnHandDeselect = true; public bool CloseOnHandDeselect = true;

View File

@@ -7,6 +7,7 @@ using Content.Shared.Physics.Pull;
using Content.Shared.Pulling; using Content.Shared.Pulling;
using Content.Shared.Pulling.Components; using Content.Shared.Pulling.Components;
using Content.Shared.Pulling.Events; using Content.Shared.Pulling.Events;
using Content.Shared.Stunnable;
using Content.Shared.Throwing; using Content.Shared.Throwing;
namespace Content.Shared.Administration; namespace Content.Shared.Administration;
@@ -29,6 +30,7 @@ public sealed class AdminFrozenSystem : EntitySystem
SubscribeLocalEvent<AdminFrozenComponent, UpdateCanMoveEvent>(OnUpdateCanMove); SubscribeLocalEvent<AdminFrozenComponent, UpdateCanMoveEvent>(OnUpdateCanMove);
SubscribeLocalEvent<AdminFrozenComponent, PullAttemptEvent>(OnPullAttempt); SubscribeLocalEvent<AdminFrozenComponent, PullAttemptEvent>(OnPullAttempt);
SubscribeLocalEvent<AdminFrozenComponent, AttackAttemptEvent>(OnAttempt); SubscribeLocalEvent<AdminFrozenComponent, AttackAttemptEvent>(OnAttempt);
SubscribeLocalEvent<AdminFrozenComponent, ChangeDirectionAttemptEvent>(OnAttempt);
} }
private void OnAttempt(EntityUid uid, AdminFrozenComponent component, CancellableEntityEventArgs args) private void OnAttempt(EntityUid uid, AdminFrozenComponent component, CancellableEntityEventArgs args)

View File

@@ -80,8 +80,7 @@ namespace Content.Shared.Interaction
public bool TryFaceAngle(EntityUid user, Angle diffAngle, TransformComponent? xform = null) public bool TryFaceAngle(EntityUid user, Angle diffAngle, TransformComponent? xform = null)
{ {
// TODO: MobState should be handling CanChangeDirection's event if (_actionBlockerSystem.CanChangeDirection(user))
if (_actionBlockerSystem.CanChangeDirection(user) && !_mobState.IsIncapacitated(user))
{ {
if (!Resolve(user, ref xform)) if (!Resolve(user, ref xform))
return false; return false;

View File

@@ -227,7 +227,7 @@ namespace Content.Shared.Interaction
if (target != null && Deleted(target.Value)) if (target != null && Deleted(target.Value))
return; return;
if (TryComp(user, out SharedCombatModeComponent? combatMode) && combatMode.IsInCombatMode) if (!altInteract && TryComp(user, out SharedCombatModeComponent? combatMode) && combatMode.IsInCombatMode)
{ {
// Eat the input // Eat the input
return; return;

View File

@@ -58,6 +58,7 @@ namespace Content.Shared.Stunnable
SubscribeLocalEvent<KnockedDownComponent, TileFrictionEvent>(OnKnockedTileFriction); SubscribeLocalEvent<KnockedDownComponent, TileFrictionEvent>(OnKnockedTileFriction);
// Attempt event subscriptions. // Attempt event subscriptions.
SubscribeLocalEvent<StunnedComponent, ChangeDirectionAttemptEvent>(OnAttempt);
SubscribeLocalEvent<StunnedComponent, UpdateCanMoveEvent>(OnMoveAttempt); SubscribeLocalEvent<StunnedComponent, UpdateCanMoveEvent>(OnMoveAttempt);
SubscribeLocalEvent<StunnedComponent, InteractionAttemptEvent>(OnAttempt); SubscribeLocalEvent<StunnedComponent, InteractionAttemptEvent>(OnAttempt);
SubscribeLocalEvent<StunnedComponent, UseAttemptEvent>(OnAttempt); SubscribeLocalEvent<StunnedComponent, UseAttemptEvent>(OnAttempt);

View File

@@ -168,6 +168,9 @@ namespace Content.Shared.Verbs
RaiseLocalEvent(verb.ExecutionEventArgs); RaiseLocalEvent(verb.ExecutionEventArgs);
} }
if (Deleted(user) || Deleted(target))
return;
// Perform any contact interactions // Perform any contact interactions
if (verb.DoContactInteraction ?? (verb.DefaultDoContactInteraction && _interactionSystem.InRangeUnobstructed(user, target))) if (verb.DoContactInteraction ?? (verb.DefaultDoContactInteraction && _interactionSystem.InRangeUnobstructed(user, target)))
_interactionSystem.DoContactInteraction(user, target); _interactionSystem.DoContactInteraction(user, target);