mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* Fix warnings in SharedJointSystem * Fix reference to EC TransformComponent method Replaces call to TransformComponent.GetMapUid with SharedTransformSystem.GetMap * Fix obsolete calls in SharedPhysicsSystem.Contacts.cs Fixes a couple calls to obsolete varients of SetAwake and an obsolete call to RegenerateContacts by converting them to their Entity<T> varients * Fix obsolete call in SharedPhysicsSystem.Components.cs Adds one set of parenthesis to convert a 'uid, comp, comp, comp' call to an 'Entity<T, T, T> call. * Removes unused local var Removes an unused list of broadphases that was being allocated in TryCollideRect * One-line fixes in SharedPhysicsSystem.Islands.cs Fixes all of the easy warnings regarding physics island processing, the rest require more complicated changes than a simple argument rearrangement * Fix obsolete method call in SharedMapSystem * Fix a few obsolete ToMap calls in EntityLookup.Queries * Fix calls to obsolete EntityCoordinate methods in SharedMapSystem.Grids * Fix calls to obsolete EntityCoordinate methods in SharedLookupSystem.ComponentQueries * Fix a few obsolete method calls in entity spawning * Fix obsolete method calls in MapLoaderSystem * Fix obsolete method call in GridFixtureSystem * Fix obsolete IsMapInitialized call in SaveMap command * Fix obsolete MapPosition reference in Client.EyeSystem * Fix obsolete EntitySystem.Get<TSystem> references in DebugLightTreeSystem * Fix obsolete EntitySystem.Get<TSystem> reference in DebugEntityLookup command * Fix obsolete method calls in SpriteBoundsOverlay Slightly more complicated than the rest, but it's really just changing an unused dependency over to use SharedTransformSystem * Remove unused IClyde references from controls LineEdit and TextEdit never use their IClyde dependencies and it generates a warning so yeet * Remove use of EntitySystem.Get from lightbb command * Fix DebugDrawingSystem Removes a bunch of unused private IEntityManager vars Also removes an obsolete use of TransformComponent.GetWorldPositionRotation * Removes duplicate position set when splitting grids There's nothing saying why this is this way and the blame looks like it was an oversight when replacing a bit where they set position and then rotation Please, oh Chesterton's Fence, spare me your wrath * Fix obsolete method use in PlacementMode * Fix obsolete method use in Placement Modes * Removes unused local var in gamestate management * Fix unreachable code warnings in gamestate management Use #else sections to make sure they don't complain about being on the wrong side of a throw * Fix obsolete ToMap use in EyeManager * Make InputManager use a sawmill to log * Fix obsolete ContainerManagerComponent method calls in ContainerSystem * Make ClientPrototypeManager use a sawmill for logging * poke tests * Use LocalizedEntityCommands for SpriteBoundsOverlay toggle * Use LocalizedEntityCommands for system toggles --------- Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
75 lines
2.4 KiB
C#
75 lines
2.4 KiB
C#
using Robust.Client.Graphics;
|
|
using Robust.Client.Physics;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Player;
|
|
|
|
namespace Robust.Client.GameObjects;
|
|
|
|
public sealed class EyeSystem : SharedEyeSystem
|
|
{
|
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<EyeComponent, ComponentInit>(OnInit);
|
|
SubscribeLocalEvent<EyeComponent, LocalPlayerDetachedEvent>(OnEyeDetached);
|
|
SubscribeLocalEvent<EyeComponent, LocalPlayerAttachedEvent>(OnEyeAttached);
|
|
SubscribeLocalEvent<EyeComponent, AfterAutoHandleStateEvent>(OnEyeAutoState);
|
|
|
|
// Make sure this runs *after* entities have been moved by interpolation and movement.
|
|
UpdatesAfter.Add(typeof(TransformSystem));
|
|
UpdatesAfter.Add(typeof(PhysicsSystem));
|
|
}
|
|
|
|
private void OnEyeAutoState(EntityUid uid, EyeComponent component, ref AfterAutoHandleStateEvent args)
|
|
{
|
|
UpdateEye((uid, component));
|
|
}
|
|
|
|
private void OnEyeAttached(EntityUid uid, EyeComponent component, LocalPlayerAttachedEvent args)
|
|
{
|
|
UpdateEye((uid, component));
|
|
_eyeManager.CurrentEye = component.Eye;
|
|
var ev = new EyeAttachedEvent(uid, component);
|
|
RaiseLocalEvent(uid, ref ev, true);
|
|
}
|
|
|
|
private void OnEyeDetached(EntityUid uid, EyeComponent component, LocalPlayerDetachedEvent args)
|
|
{
|
|
_eyeManager.ClearCurrentEye();
|
|
}
|
|
|
|
private void OnInit(EntityUid uid, EyeComponent component, ComponentInit args)
|
|
{
|
|
UpdateEye((uid, component));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void FrameUpdate(float frameTime)
|
|
{
|
|
var query = AllEntityQuery<EyeComponent>();
|
|
|
|
while (query.MoveNext(out var uid, out var eyeComponent))
|
|
{
|
|
if (eyeComponent.Eye == null)
|
|
continue;
|
|
|
|
if (!TryComp<TransformComponent>(eyeComponent.Target, out var xform))
|
|
{
|
|
xform = Transform(uid);
|
|
eyeComponent.Target = null;
|
|
}
|
|
|
|
eyeComponent.Eye.Position = TransformSystem.GetMapCoordinates(xform);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Raised on an entity when it is attached to one with an <see cref="EyeComponent"/>
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public readonly record struct EyeAttachedEvent(EntityUid Entity, EyeComponent Component);
|