* commit

* commit

* commit
This commit is contained in:
Spatison
2024-07-14 16:26:12 +03:00
committed by GitHub
parent f60271327d
commit 9b2247bcc7
8 changed files with 72 additions and 61 deletions

View File

@@ -56,10 +56,7 @@ internal sealed class BuckleSystem : SharedBuckleSystem
if (!Appearance.TryGetData<bool>(uid, BuckleVisuals.Buckled, out var buckled, args.Component) || if (!Appearance.TryGetData<bool>(uid, BuckleVisuals.Buckled, out var buckled, args.Component) ||
!buckled || !buckled ||
args.Sprite == null) args.Sprite == null)
{
_rotationVisualizerSystem.SetHorizontalAngle((uid, rotVisuals), rotVisuals.DefaultRotation);
return; return;
}
// Animate strapping yourself to something at a given angle // Animate strapping yourself to something at a given angle
// TODO: Dump this when buckle is better // TODO: Dump this when buckle is better

View File

@@ -1,41 +0,0 @@
using Content.Shared.Rotation;
using Robust.Client.GameObjects;
namespace Content.Client._White.Rotation;
public sealed class RotationVisualizerSystem : EntitySystem
{
[Dependency] private readonly AppearanceSystem _appearance = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize()
{
SubscribeLocalEvent<RotationVisualsComponent, MoveEvent>(OnMove);
}
private void OnMove(EntityUid uid, RotationVisualsComponent component, ref MoveEvent args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite) ||
!TryComp<AppearanceComponent>(uid, out var appearance))
return;
_appearance.TryGetData<RotationState>(uid, RotationVisuals.RotationState, out var state, appearance);
var rotation = _transform.GetWorldRotation(uid);
if (rotation.GetDir() is Direction.East or Direction.North or Direction.NorthEast or Direction.SouthEast)
{
if (state == RotationState.Horizontal &&
sprite.Rotation == component.DefaultRotation)
{
sprite.Rotation = Angle.FromDegrees(270);
}
return;
}
if (state == RotationState.Horizontal &&
sprite.Rotation == Angle.FromDegrees(270))
{
sprite.Rotation = component.DefaultRotation;
}
}
}

View File

@@ -0,0 +1,46 @@
using Content.Shared.Rotation;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
namespace Content.Client._White.Rotation;
public sealed class RotationVisualizerWhiteSystem : EntitySystem
{
[Dependency] private readonly AppearanceSystem _appearance = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;
public override void Initialize()
{
SubscribeLocalEvent<RotationVisualsComponent, MoveEvent>(OnMove);
}
private void OnMove(EntityUid uid, RotationVisualsComponent component, ref MoveEvent args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite) ||
!TryComp<AppearanceComponent>(uid, out var appearance) ||
!TryComp<TransformComponent>(uid, out var transform) ||
component.DefaultRotation == 0)
return;
_appearance.TryGetData<RotationState>(uid, RotationVisuals.RotationState, out var state, appearance);
var rotation = transform.LocalRotation + _eyeManager.CurrentEye.Rotation;
if (rotation.GetDir() is Direction.East or Direction.North or Direction.NorthEast or Direction.SouthEast)
{
if (state != RotationState.Horizontal ||
sprite.Rotation != component.DefaultRotation)
return;
component.HorizontalRotation = Angle.FromDegrees(270);
sprite.Rotation = Angle.FromDegrees(270);
return;
}
if (state != RotationState.Horizontal ||
sprite.Rotation != Angle.FromDegrees(270))
return;
component.HorizontalRotation = component.DefaultRotation;
sprite.Rotation = component.DefaultRotation;
}
}

View File

@@ -220,7 +220,7 @@ public sealed class SurveillanceCameraSystem : EntitySystem
return; return;
} }
if (camera.NameSet && camera.NetworkSet) if (camera.NameSet && camera.NetworkSet && !TryComp<SurveillanceBodyCameraComponent>(uid, out _)) // WD EDIT
{ {
_userInterface.TryCloseAll(uid, SurveillanceCameraSetupUiKey.Camera); _userInterface.TryCloseAll(uid, SurveillanceCameraSetupUiKey.Camera);
return; return;

View File

@@ -9,6 +9,7 @@ using Content.Shared.Actions;
using Content.Shared.PowerCell.Components; using Content.Shared.PowerCell.Components;
using Content.Shared._White.SurveillanceCamera; using Content.Shared._White.SurveillanceCamera;
using Content.Shared.IdentityManagement; using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Toggleable; using Content.Shared.Toggleable;
using Robust.Shared.Player; using Robust.Shared.Player;
@@ -61,7 +62,7 @@ public sealed class SurveillanceBodyCameraSystem : EntitySystem
_popup.PopupEntity(message, uid, Filter.PvsExcept(uid, entityManager: EntityManager), true); _popup.PopupEntity(message, uid, Filter.PvsExcept(uid, entityManager: EntityManager), true);
} }
public void OnInit(EntityUid uid, SurveillanceBodyCameraComponent comp, ComponentInit args) private void OnInit(EntityUid uid, SurveillanceBodyCameraComponent comp, ComponentInit args)
{ {
if (!TryComp<SurveillanceCameraComponent>(uid, out var surComp)) if (!TryComp<SurveillanceCameraComponent>(uid, out var surComp))
return; return;
@@ -115,7 +116,7 @@ public sealed class SurveillanceBodyCameraSystem : EntitySystem
AppearanceChange(uid, surComp.Active); AppearanceChange(uid, surComp.Active);
} }
public void OnExamine(EntityUid uid, SurveillanceBodyCameraComponent comp, ExaminedEvent args) private void OnExamine(EntityUid uid, SurveillanceBodyCameraComponent comp, ExaminedEvent args)
{ {
if (!TryComp<SurveillanceCameraComponent>(uid, out var surComp)) if (!TryComp<SurveillanceCameraComponent>(uid, out var surComp))
return; return;
@@ -128,7 +129,7 @@ public sealed class SurveillanceBodyCameraSystem : EntitySystem
args.PushMarkup(message); args.PushMarkup(message);
} }
public void AppearanceChange(EntityUid uid, bool isActive) private void AppearanceChange(EntityUid uid, bool isActive)
{ {
if (!TryComp<AppearanceComponent>(uid, out var appearance) || if (!TryComp<AppearanceComponent>(uid, out var appearance) ||
!TryComp<ItemComponent>(uid, out var item)) !TryComp<ItemComponent>(uid, out var item))

View File

@@ -82,13 +82,12 @@ public partial class MobStateSystem
_appearance.SetData(target, MobStateVisuals.State, MobState.Alive); _appearance.SetData(target, MobStateVisuals.State, MobState.Alive);
break; break;
case MobState.Critical: case MobState.Critical:
_standing.Down(target);
_appearance.SetData(target, MobStateVisuals.State, MobState.Critical); _appearance.SetData(target, MobStateVisuals.State, MobState.Critical);
_standing.Down(target);
break; break;
case MobState.Dead: case MobState.Dead:
_standing.Down(target);
_appearance.SetData(target, MobStateVisuals.State, MobState.Dead); _appearance.SetData(target, MobStateVisuals.State, MobState.Dead);
_standing.Down(target);
break; break;
case MobState.Invalid: case MobState.Invalid:
//unused; //unused;

View File

@@ -10,6 +10,7 @@ using Content.Shared.Stunnable;
using Content.Shared._White.Wizard.Timestop; using Content.Shared._White.Wizard.Timestop;
using Content.Shared.Buckle; using Content.Shared.Buckle;
using Content.Shared.Buckle.Components; using Content.Shared.Buckle.Components;
using Content.Shared.Mobs;
using Robust.Shared.Audio.Systems; using Robust.Shared.Audio.Systems;
using Robust.Shared.Input.Binding; using Robust.Shared.Input.Binding;
using Robust.Shared.Physics; using Robust.Shared.Physics;
@@ -236,15 +237,22 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
standingState.CurrentState = StandingState.Lying; standingState.CurrentState = StandingState.Lying;
Dirty(uid, standingState); Dirty(uid, standingState);
var rotation = _transform.GetWorldRotation(uid); // WD EDIT if (TryComp<TransformComponent>(uid, out var transform)) // WD EDIT
_appearance.TryGetData<bool>(uid, BuckleVisuals.Buckled, out var state, appearance); // WD EDIT
if (!state) // WD EDIT
{ {
if (rotation.GetDir() is Direction.East or Direction.North or Direction.NorthEast or Direction.SouthEast) var rotation = transform.LocalRotation;
_rotation.SetHorizontalAngle(uid, Angle.FromDegrees(270)); _appearance.TryGetData<bool>(uid, BuckleVisuals.Buckled, out var buckled, appearance);
else
_rotation.ResetHorizontalAngle(uid); if (!buckled && (!_appearance.TryGetData<MobState>(uid, MobStateVisuals.State, out var state, appearance) ||
state is MobState.Alive))
{
if (rotation.GetDir() is Direction.East
or Direction.North
or Direction.NorthEast
or Direction.SouthEast)
_rotation.SetHorizontalAngle(uid, Angle.FromDegrees(270));
else
_rotation.ResetHorizontalAngle(uid);
}
} }
RaiseLocalEvent(uid, new DownedEvent()); RaiseLocalEvent(uid, new DownedEvent());

View File

@@ -51,6 +51,7 @@
- type: InstantAction - type: InstantAction
itemIconStyle: BigAction itemIconStyle: BigAction
priority: -20 priority: -20
icon: { sprite: Objects\Specific\Security\body-camera.rsi, state: unpowered } icon:
iconOn: { sprite: Objects\Specific\Security\body-camera.rsi, state: active } sprite: Objects\Specific\Security\body-camera.rsi
state: unpowered
event: !type:ToggleBodyCameraEvent event: !type:ToggleBodyCameraEvent