Merge remote-tracking branch 'Parsec-core/master' into upstream-core

This commit is contained in:
BIGZi0348
2025-03-21 21:29:04 +03:00
11 changed files with 91 additions and 130 deletions

View File

@@ -82,12 +82,15 @@ public sealed partial class GhostComponent : Component
}
}
[DataField, AutoNetworkedField]
public bool Visible;
/// <summary>
/// Ghost color
/// </summary>
/// <remarks>Used to allow admins to change ghost colors. Should be removed if the capability to edit existing sprite colors is ever added back.</remarks>
[DataField("color"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public Color color = Color.White;
[DataField("color"), AutoNetworkedField]
public Color Color = Color.White;
[DataField("canReturnToBody"), AutoNetworkedField]
private bool _canReturnToBody;

View File

@@ -53,6 +53,14 @@ namespace Content.Shared.Ghost
{
component.CanReturnToBody = value;
}
public virtual void SetVisible(Entity<GhostComponent?> ghost, bool visible)
{
if (!Resolve(ghost.Owner, ref ghost.Comp))
return;
ghost.Comp.Visible = visible;
Dirty(ghost);
}
}
/// <summary>

View File

@@ -12,4 +12,7 @@ public sealed partial class CorporealComponent : Component
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public float MovementSpeedDebuff = 0.4f; // WD EDIT
[DataField]
public bool MadeVisible;
}

View File

@@ -1,6 +1,7 @@
using Content.Shared.Physics;
using Robust.Shared.Physics;
using System.Linq;
using Content.Shared.Ghost;
using Content.Shared.Movement.Systems;
using Content.Shared.Revenant.Components;
using Robust.Shared.Physics.Systems;
@@ -17,6 +18,7 @@ public abstract class SharedCorporealSystem : EntitySystem
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedGhostSystem _ghost = default!;
public override void Initialize()
{
@@ -44,6 +46,12 @@ public abstract class SharedCorporealSystem : EntitySystem
_physics.SetCollisionLayer(uid, fixture.Key, fixture.Value, (int) CollisionGroup.SmallMobLayer, fixtures);
}
_movement.RefreshMovementSpeedModifiers(uid);
if (!TryComp(uid, out GhostComponent? ghost) || ghost.Visible)
return;
component.MadeVisible = true;
_ghost.SetVisible((uid, ghost), true);
}
public virtual void OnShutdown(EntityUid uid, CorporealComponent component, ComponentShutdown args)
@@ -59,5 +67,8 @@ public abstract class SharedCorporealSystem : EntitySystem
}
component.MovementSpeedDebuff = 1; //just so we can avoid annoying code elsewhere
_movement.RefreshMovementSpeedModifiers(uid);
if (component.MadeVisible && TryComp(uid, out GhostComponent? ghost))
_ghost.SetVisible((uid, ghost), false);
}
}