перенос
This commit is contained in:
@@ -28,11 +28,7 @@ namespace Content.Server.Administration.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
var ghostSys = _entities.EntitySysManager.GetEntitySystem<GhostSystem>();
|
||||
var revSys = _entities.EntitySysManager.GetEntitySystem<RevenantSystem>();
|
||||
|
||||
ghostSys.MakeVisible(visible);
|
||||
revSys.MakeVisible(visible);
|
||||
_entities.System<GhostSystem>().MakeVisible(visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,6 +208,33 @@ namespace Content.Server.Ghost
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
public override void SetVisible(Entity<GhostComponent?> ghost, bool visible)
|
||||
{
|
||||
if (!Resolve(ghost.Owner, ref ghost.Comp))
|
||||
return;
|
||||
|
||||
if (ghost.Comp.Visible == visible)
|
||||
return;
|
||||
|
||||
base.SetVisible(ghost, visible);
|
||||
|
||||
if (!TryComp(ghost.Owner, out VisibilityComponent? visibility))
|
||||
return;
|
||||
|
||||
if (visible)
|
||||
{
|
||||
_visibilitySystem.RemoveLayer((ghost.Owner, visibility), (int)VisibilityFlags.Ghost, false);
|
||||
_visibilitySystem.AddLayer((ghost.Owner, visibility), (int)VisibilityFlags.Normal, false);
|
||||
_visibilitySystem.RefreshVisibility(ghost.Owner, visibility);
|
||||
}
|
||||
else
|
||||
{
|
||||
_visibilitySystem.AddLayer((ghost.Owner, visibility), (int)VisibilityFlags.Ghost, false);
|
||||
_visibilitySystem.RemoveLayer((ghost.Owner, visibility), (int)VisibilityFlags.Normal, false);
|
||||
_visibilitySystem.RefreshVisibility(ghost.Owner, visibility);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnActionPerform(EntityUid uid, GhostComponent component, BooActionEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
@@ -257,7 +284,7 @@ namespace Content.Server.Ghost
|
||||
// Allow this entity to be seen by other ghosts.
|
||||
var visibility = EnsureComp<VisibilityComponent>(uid);
|
||||
|
||||
if (_ticker.RunLevel != GameRunLevel.PostRound)
|
||||
if (_ticker.RunLevel != GameRunLevel.PostRound && !component.Visible)
|
||||
{
|
||||
_visibilitySystem.AddLayer(uid, visibility, (int) VisibilityFlags.Ghost, false);
|
||||
_visibilitySystem.RemoveLayer(uid, visibility, (int) VisibilityFlags.Normal, false);
|
||||
@@ -277,7 +304,7 @@ namespace Content.Server.Ghost
|
||||
return;
|
||||
|
||||
// Entity can't be seen by ghosts anymore.
|
||||
if (TryComp(uid, out VisibilityComponent? visibility))
|
||||
if (TryComp(uid, out VisibilityComponent? visibility) && !component.Visible)
|
||||
{
|
||||
_visibilitySystem.RemoveLayer(uid, visibility, (int) VisibilityFlags.Ghost, false);
|
||||
_visibilitySystem.AddLayer(uid, visibility, (int) VisibilityFlags.Normal, false);
|
||||
@@ -330,24 +357,16 @@ namespace Content.Server.Ghost
|
||||
|
||||
private void OnMindRemovedMessage(EntityUid uid, GhostComponent component, MindRemovedMessage args)
|
||||
{
|
||||
DeleteEntity(uid);
|
||||
QueueDel(uid);
|
||||
}
|
||||
|
||||
private void OnMindUnvisitedMessage(EntityUid uid, GhostComponent component, MindUnvisitedMessage args)
|
||||
{
|
||||
DeleteEntity(uid);
|
||||
QueueDel(uid);
|
||||
}
|
||||
|
||||
private void OnPlayerDetached(EntityUid uid, GhostComponent component, PlayerDetachedEvent args)
|
||||
{
|
||||
DeleteEntity(uid);
|
||||
}
|
||||
|
||||
private void DeleteEntity(EntityUid uid)
|
||||
{
|
||||
if (Deleted(uid) || Terminating(uid))
|
||||
return;
|
||||
|
||||
QueueDel(uid);
|
||||
}
|
||||
|
||||
@@ -543,25 +562,14 @@ namespace Content.Server.Ghost
|
||||
/// </summary>
|
||||
public void MakeVisible(bool visible)
|
||||
{
|
||||
var entityQuery = EntityQueryEnumerator<GhostComponent, VisibilityComponent>();
|
||||
while (entityQuery.MoveNext(out var uid, out _, out var vis))
|
||||
var entityQuery = EntityQueryEnumerator<GhostComponent>();
|
||||
while (entityQuery.MoveNext(out var uid, out var ghost))
|
||||
{
|
||||
// WD
|
||||
if (EntityManager.TryGetComponent(vis.Owner, out InvisibilityComponent? invis) && invis.Invisible)
|
||||
if (EntityManager.TryGetComponent(uid, out InvisibilityComponent? invis) && invis.Invisible)
|
||||
continue;
|
||||
|
||||
if (visible)
|
||||
{
|
||||
_visibilitySystem.AddLayer(uid, vis, (int) VisibilityFlags.Normal, false);
|
||||
_visibilitySystem.RemoveLayer(uid, vis, (int) VisibilityFlags.Ghost, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_visibilitySystem.AddLayer(uid, vis, (int) VisibilityFlags.Ghost, false);
|
||||
_visibilitySystem.RemoveLayer(uid, vis, (int) VisibilityFlags.Normal, false);
|
||||
}
|
||||
|
||||
_visibilitySystem.RefreshVisibility(uid, visibilityComponent: vis);
|
||||
SetVisible((uid, ghost), visible);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,37 +1,7 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Shared.Eye;
|
||||
using Content.Shared.Revenant.Components;
|
||||
using Content.Shared.Revenant.EntitySystems;
|
||||
using Robust.Server.GameObjects;
|
||||
using Content.Shared.Revenant.EntitySystems;
|
||||
|
||||
namespace Content.Server.Revenant.EntitySystems;
|
||||
|
||||
public sealed class CorporealSystem : SharedCorporealSystem
|
||||
{
|
||||
[Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
|
||||
public override void OnStartup(EntityUid uid, CorporealComponent component, ComponentStartup args)
|
||||
{
|
||||
base.OnStartup(uid, component, args);
|
||||
|
||||
if (TryComp<VisibilityComponent>(uid, out var visibility))
|
||||
{
|
||||
_visibilitySystem.RemoveLayer(uid, visibility, (int) VisibilityFlags.Ghost, false);
|
||||
_visibilitySystem.AddLayer(uid, visibility, (int) VisibilityFlags.Normal, false);
|
||||
_visibilitySystem.RefreshVisibility(uid, visibility);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnShutdown(EntityUid uid, CorporealComponent component, ComponentShutdown args)
|
||||
{
|
||||
base.OnShutdown(uid, component, args);
|
||||
|
||||
if (TryComp<VisibilityComponent>(uid, out var visibility) && _ticker.RunLevel != GameRunLevel.PostRound)
|
||||
{
|
||||
_visibilitySystem.AddLayer(uid, visibility, (int) VisibilityFlags.Ghost, false);
|
||||
_visibilitySystem.RemoveLayer(uid, visibility, (int) VisibilityFlags.Normal, false);
|
||||
_visibilitySystem.RefreshVisibility(uid, visibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ public sealed partial class RevenantSystem : EntitySystem
|
||||
[Dependency] private readonly AlertsSystem _alerts = default!;
|
||||
[Dependency] private readonly DamageableSystem _damage = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly PhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
||||
@@ -46,7 +45,6 @@ public sealed partial class RevenantSystem : EntitySystem
|
||||
[Dependency] private readonly SharedStunSystem _stun = default!;
|
||||
[Dependency] private readonly StoreSystem _store = default!;
|
||||
[Dependency] private readonly TagSystem _tag = default!;
|
||||
[Dependency] private readonly VisibilitySystem _visibility = default!;
|
||||
|
||||
[ValidatePrototypeId<EntityPrototype>]
|
||||
private const string RevenantShopId = "ActionRevenantShop";
|
||||
@@ -63,7 +61,6 @@ public sealed partial class RevenantSystem : EntitySystem
|
||||
SubscribeLocalEvent<RevenantComponent, ExaminedEvent>(OnExamine);
|
||||
SubscribeLocalEvent<RevenantComponent, StatusEffectAddedEvent>(OnStatusAdded);
|
||||
SubscribeLocalEvent<RevenantComponent, StatusEffectEndedEvent>(OnStatusEnded);
|
||||
SubscribeLocalEvent<RoundEndTextAppendEvent>(_ => MakeVisible(true));
|
||||
|
||||
SubscribeLocalEvent<RevenantComponent, AttackedEvent>(OnAttacked); // WD EDIT
|
||||
|
||||
@@ -90,18 +87,9 @@ public sealed partial class RevenantSystem : EntitySystem
|
||||
_appearance.SetData(uid, RevenantVisuals.Harvesting, false);
|
||||
_appearance.SetData(uid, RevenantVisuals.Stunned, false);
|
||||
|
||||
if (_ticker.RunLevel == GameRunLevel.PostRound && TryComp<VisibilityComponent>(uid, out var visibility))
|
||||
{
|
||||
_visibility.AddLayer(uid, visibility, (int) VisibilityFlags.Ghost, false);
|
||||
_visibility.RemoveLayer(uid, visibility, (int) VisibilityFlags.Normal, false);
|
||||
_visibility.RefreshVisibility(uid, visibility);
|
||||
}
|
||||
|
||||
//ghost vision
|
||||
if (TryComp(uid, out EyeComponent? eye))
|
||||
{
|
||||
_eye.SetVisibilityMask(uid, eye.VisibilityMask | (int) (VisibilityFlags.Ghost), eye);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, RevenantComponent component, MapInitEvent args)
|
||||
@@ -199,25 +187,6 @@ public sealed partial class RevenantSystem : EntitySystem
|
||||
_store.ToggleUi(uid, uid, store);
|
||||
}
|
||||
|
||||
public void MakeVisible(bool visible)
|
||||
{
|
||||
var query = EntityQueryEnumerator<RevenantComponent, VisibilityComponent>();
|
||||
while (query.MoveNext(out var uid, out _, out var vis))
|
||||
{
|
||||
if (visible)
|
||||
{
|
||||
_visibility.AddLayer(uid, vis, (int) VisibilityFlags.Normal, false);
|
||||
_visibility.RemoveLayer(uid, vis, (int) VisibilityFlags.Ghost, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_visibility.AddLayer(uid, vis, (int) VisibilityFlags.Ghost, false);
|
||||
_visibility.RemoveLayer(uid, vis, (int) VisibilityFlags.Normal, false);
|
||||
}
|
||||
_visibility.RefreshVisibility(uid, vis);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
Reference in New Issue
Block a user