mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 15:47:26 +00:00
feat: Unorbitable component (#6435)
* feat: Unorbitable component * feat: stealthmin adds/removes Unorbitable
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Shared._DV.Administration.Components; // DeltaV - Unorbitable
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -6,7 +7,7 @@ using Robust.Shared.Utility;
|
||||
namespace Content.Server.Administration.Commands;
|
||||
|
||||
[AdminCommand(AdminFlags.Stealth)]
|
||||
public sealed class StealthminCommand : LocalizedCommands
|
||||
public sealed class StealthminCommand : LocalizedEntityCommands // DeltaV - Unorbitable, LocalizedCommands to LocalizedEntityCommands
|
||||
{
|
||||
[Dependency] private readonly IAdminManager _adminManager = default!;
|
||||
|
||||
@@ -26,8 +27,20 @@ public sealed class StealthminCommand : LocalizedCommands
|
||||
DebugTools.AssertNotNull(adminData);
|
||||
|
||||
if (!adminData!.Stealth)
|
||||
{
|
||||
_adminManager.Stealth(player);
|
||||
// DeltaV - Unorbitable START
|
||||
if (player.AttachedEntity is { } attachedEntity)
|
||||
EntityManager.EnsureComponent<UnorbitableComponent>(attachedEntity);
|
||||
// DeltaV END
|
||||
}
|
||||
else
|
||||
{
|
||||
_adminManager.UnStealth(player);
|
||||
// DeltaV - Unorbitable START
|
||||
if (player.AttachedEntity is { } attachedEntity)
|
||||
EntityManager.RemoveComponent<UnorbitableComponent>(attachedEntity);
|
||||
// DeltaV END
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.NameModifier.EntitySystems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Server.Preferences.Managers; // DeltaV
|
||||
using Content.Shared._DV.Administration.EntitySystems; // DeltaV - Unorbitable
|
||||
using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Warps;
|
||||
@@ -75,6 +76,7 @@ namespace Content.Server.Ghost
|
||||
[Dependency] private readonly GhostSpriteStateSystem _ghostState = default!;
|
||||
[Dependency] private readonly IServerPreferencesManager _preferencesManager = default!; // DeltaV
|
||||
[Dependency] private readonly IAdminManager _admin = default!; // DeltaV
|
||||
[Dependency] private readonly UnorbitableSystem _unorbitable = default!; // DeltaV - Unorbitable
|
||||
|
||||
private EntityQuery<GhostComponent> _ghostQuery;
|
||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
||||
@@ -341,6 +343,11 @@ namespace Content.Server.Ghost
|
||||
return;
|
||||
}
|
||||
|
||||
// DeltaV - Unorbitable START
|
||||
if (!_unorbitable.CanFollow(attached, realTarget))
|
||||
return;
|
||||
// DeltaV END
|
||||
|
||||
WarpTo(attached, realTarget);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Shared._DV.Administration.EntitySystems; // DeltaV - Unorbitable
|
||||
using Content.Shared.Administration.Managers;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Follower.Components;
|
||||
@@ -33,6 +34,7 @@ public sealed class FollowerSystem : EntitySystem
|
||||
[Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!;
|
||||
[Dependency] private readonly INetManager _netMan = default!;
|
||||
[Dependency] private readonly ISharedAdminManager _adminManager = default!;
|
||||
[Dependency] private readonly UnorbitableSystem _unorbitable = default!; // DeltaV - Unorbitable
|
||||
|
||||
private static readonly ProtoId<TagPrototype> ForceableFollowTag = "ForceableFollow";
|
||||
private static readonly ProtoId<TagPrototype> PreventGhostnadoWarpTag = "NotGhostnadoWarpable";
|
||||
@@ -98,6 +100,11 @@ public sealed class FollowerSystem : EntitySystem
|
||||
if (ev.User == ev.Target || IsClientSide(ev.Target))
|
||||
return;
|
||||
|
||||
// DeltaV - Unorbitable START
|
||||
if (!_unorbitable.CanFollow(ev.User, ev.Target))
|
||||
return;
|
||||
// DeltaV END
|
||||
|
||||
if (HasComp<GhostComponent>(ev.User))
|
||||
{
|
||||
var verb = new AlternativeVerb()
|
||||
@@ -187,6 +194,11 @@ public sealed class FollowerSystem : EntitySystem
|
||||
if (follower == entity || TerminatingOrDeleted(entity))
|
||||
return;
|
||||
|
||||
// DeltaV - Unorbitable START
|
||||
if (!_unorbitable.CanFollow(follower, entity))
|
||||
return;
|
||||
// DeltaV END
|
||||
|
||||
// No recursion for you
|
||||
var targetXform = Transform(entity);
|
||||
while (targetXform.ParentUid.IsValid())
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared._DV.Administration.Components;
|
||||
|
||||
/// This component prevents an entity from being followed by ghosts.
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class UnorbitableComponent : Component
|
||||
{
|
||||
/// Whether to allow adminned players to follow the entity.
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool AllowAdmins = false;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Content.Shared._DV.Administration.Components;
|
||||
using Content.Shared.Administration.Managers;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.Follower.Components;
|
||||
|
||||
namespace Content.Shared._DV.Administration.EntitySystems;
|
||||
|
||||
public sealed class UnorbitableSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly FollowerSystem _followerSystem = default!;
|
||||
[Dependency] private readonly ISharedAdminManager _admin = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<UnorbitableComponent, ComponentInit>(OnInit);
|
||||
}
|
||||
|
||||
private void OnInit(Entity<UnorbitableComponent> ent, ref ComponentInit args)
|
||||
{
|
||||
if (!HasComp<FollowedComponent>(ent))
|
||||
return;
|
||||
|
||||
_followerSystem.StopAllFollowers(ent);
|
||||
}
|
||||
|
||||
public bool CanFollow(EntityUid follower, EntityUid target)
|
||||
{
|
||||
if (TryComp<UnorbitableComponent>(target, out var unorbitable))
|
||||
{
|
||||
return unorbitable.AllowAdmins && _admin.IsAdmin(follower);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
cmd-stealthmin-desc = Toggle whether others can see you in adminwho and your current entity is followable by ghosts.
|
||||
cmd-stealthmin-help = Usage: stealthmin\nUse stealthmin to toggle whether you appear in the output of the adminwho command and your current entity is followable by ghosts.
|
||||
@@ -1,2 +1,3 @@
|
||||
cmd-stealthmin-desc = Toggle whether others can see you in adminwho.
|
||||
cmd-stealthmin-help = Usage: stealthmin\nUse stealthmin to toggle whether you appear in the output of the adminwho command.
|
||||
# DeltaV - replaced
|
||||
# cmd-stealthmin-desc = Toggle whether others can see you in adminwho.
|
||||
# cmd-stealthmin-help = Usage: stealthmin\nUse stealthmin to toggle whether you appear in the output of the adminwho command.
|
||||
|
||||
Reference in New Issue
Block a user