Re-organize all projects (#4166)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Ghost.Components;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
@@ -35,7 +35,7 @@ namespace Content.Server.Administration.Commands
|
||||
var chat = IoCManager.Resolve<IChatManager>();
|
||||
|
||||
chat.SendAdminDeadChat(player, message);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Spawn)]
|
||||
public class DeleteEntityCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "deleteentity";
|
||||
public string Description => "Deletes an entity with the given id.";
|
||||
public string Help => $"Usage: {Command} <id>";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.WriteLine($"Invalid amount of arguments.\n{Help}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EntityUid.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.WriteLine($"{args[0]} is not a valid entity id.");
|
||||
return;
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!entityManager.TryGetEntity(id, out var entity))
|
||||
{
|
||||
shell.WriteLine($"No entity found with id {id}.");
|
||||
return;
|
||||
}
|
||||
|
||||
entity.Delete();
|
||||
shell.WriteLine($"Deleted entity with id {id}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Explosions;
|
||||
using Content.Server.Explosion;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Mapping)]
|
||||
public class FindEntitiesWithComponents : IConsoleCommand
|
||||
{
|
||||
public string Command => "findentitieswithcomponents";
|
||||
public string Description => "Finds entities with all of the specified components.";
|
||||
public string Help => $"{Command} <componentName1> <componentName2>...";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
shell.WriteLine($"Invalid amount of arguments: {args.Length}.\n{Help}");
|
||||
return;
|
||||
}
|
||||
|
||||
var components = new List<Type>();
|
||||
var componentFactory = IoCManager.Resolve<IComponentFactory>();
|
||||
var invalidArgs = new List<string>();
|
||||
|
||||
foreach (var arg in args)
|
||||
{
|
||||
if (!componentFactory.TryGetRegistration(arg, out var registration))
|
||||
{
|
||||
invalidArgs.Add(arg);
|
||||
continue;
|
||||
}
|
||||
|
||||
components.Add(registration.Type);
|
||||
}
|
||||
|
||||
if (invalidArgs.Count > 0)
|
||||
{
|
||||
shell.WriteLine($"No component found for component names: {string.Join(", ", invalidArgs)}");
|
||||
return;
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var query = new MultipleTypeEntityQuery(components);
|
||||
var entityIds = new HashSet<string>();
|
||||
|
||||
foreach (var entity in entityManager.GetEntities(query))
|
||||
{
|
||||
if (entity.Prototype == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
entityIds.Add(entity.Prototype.ID);
|
||||
}
|
||||
|
||||
if (entityIds.Count == 0)
|
||||
{
|
||||
shell.WriteLine($"No entities found with components {string.Join(", ", args)}.");
|
||||
return;
|
||||
}
|
||||
|
||||
shell.WriteLine($"{entityIds.Count} entities found:\n{string.Join("\n", entityIds)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Eui;
|
||||
using Content.Server.Administration.UI;
|
||||
using Content.Server.EUI;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#nullable enable
|
||||
using Content.Server.Administration.Managers;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Server.Administration.Managers;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#nullable enable
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.GlobalVerbs;
|
||||
using Content.Server.Damage;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Mapping)]
|
||||
public class RemoveExtraComponents : IConsoleCommand
|
||||
{
|
||||
public string Command => "removeextracomponents";
|
||||
public string Description => "Removes all components from all entities of the specified id if that component is not in its prototype.\nIf no id is specified, it matches all entities.";
|
||||
public string Help => $"{Command} <entityId> / {Command}";
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var id = args.Length == 0 ? null : string.Join(" ", args);
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
|
||||
EntityPrototype? prototype = null;
|
||||
var checkPrototype = !string.IsNullOrEmpty(id);
|
||||
|
||||
if (checkPrototype && !prototypeManager.TryIndex(id!, out prototype))
|
||||
{
|
||||
shell.WriteError($"Can't find entity prototype with id \"{id}\"!");
|
||||
return;
|
||||
}
|
||||
|
||||
var entities = 0;
|
||||
var components = 0;
|
||||
|
||||
foreach (var entity in entityManager.GetEntities())
|
||||
{
|
||||
if (checkPrototype && entity.Prototype != prototype || entity.Prototype == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var modified = false;
|
||||
|
||||
foreach (var component in entity.GetAllComponents())
|
||||
{
|
||||
if (entity.Prototype.Components.ContainsKey(component.Name))
|
||||
continue;
|
||||
|
||||
entityManager.ComponentManager.RemoveComponent(entity.Uid, component);
|
||||
components++;
|
||||
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (modified)
|
||||
entities++;
|
||||
}
|
||||
|
||||
shell.WriteLine($"Removed {components} components from {entities} entities{(id == null ? "." : $" with id {id}")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using Content.Server.Database;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#nullable enable
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.Mobs;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
@@ -69,7 +68,7 @@ namespace Content.Server.Administration.Commands
|
||||
var mind = playerCData.Mind;
|
||||
if (mind == null)
|
||||
{
|
||||
mind = new Mind(session.UserId)
|
||||
mind = new Mind.Mind(session.UserId)
|
||||
{
|
||||
CharacterName = target.Name
|
||||
};
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#nullable enable
|
||||
using Content.Server.Eui;
|
||||
using Content.Server.GameObjects.Components.GUI;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Server.GameObjects.Components.PDA;
|
||||
using Content.Server.Administration.UI;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Inventory.Components;
|
||||
using Content.Server.Items;
|
||||
using Content.Server.PDA;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Roles;
|
||||
using NFluidsynth;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Markers;
|
||||
using Content.Server.Warps;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -2,16 +2,14 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.Database;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Administration.AdminMenu;
|
||||
using Content.Shared.Network.NetMessages;
|
||||
using Content.Shared.Administration.Menu;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
@@ -26,7 +24,7 @@ using YamlDotNet.RepresentationModel;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Server.Administration
|
||||
namespace Content.Server.Administration.Managers
|
||||
{
|
||||
public sealed class AdminManager : IAdminManager, IPostInjectInit, IConGroupControllerImplementation
|
||||
{
|
||||
@@ -416,7 +414,7 @@ namespace Content.Server.Administration
|
||||
addr = addr.MapToIPv4();
|
||||
}
|
||||
|
||||
return Equals(addr, IPAddress.Loopback) || Equals(addr, IPAddress.IPv6Loopback);
|
||||
return Equals(addr, System.Net.IPAddress.Loopback) || Equals(addr, System.Net.IPAddress.IPv6Loopback);
|
||||
}
|
||||
|
||||
public bool CanCommand(IPlayerSession session, string cmdName)
|
||||
@@ -5,7 +5,7 @@ using Robust.Server.Player;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Server.Administration
|
||||
namespace Content.Server.Administration.Managers
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages server administrators and their permission flags.
|
||||
@@ -2,8 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.Database;
|
||||
using Content.Server.Eui;
|
||||
using Content.Server.EUI;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Eui;
|
||||
using Robust.Server.Player;
|
||||
@@ -15,7 +16,7 @@ using static Content.Shared.Administration.PermissionsEuiMsg;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Server.Administration
|
||||
namespace Content.Server.Administration.UI
|
||||
{
|
||||
public sealed class PermissionsEui : BaseEui
|
||||
{
|
||||
52
Content.Server/Administration/UI/SetOutfitEui.cs
Normal file
52
Content.Server/Administration/UI/SetOutfitEui.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.EUI;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Eui;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Administration.UI
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class SetOutfitEui : BaseEui
|
||||
{
|
||||
[Dependency] private readonly IAdminManager _adminManager = default!;
|
||||
private readonly IEntity _target;
|
||||
public SetOutfitEui(IEntity entity)
|
||||
{
|
||||
_target = entity;
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
|
||||
public override void Opened()
|
||||
{
|
||||
base.Opened();
|
||||
|
||||
StateDirty();
|
||||
_adminManager.OnPermsChanged += AdminManagerOnPermsChanged;
|
||||
}
|
||||
|
||||
public override EuiStateBase GetNewState()
|
||||
{
|
||||
return new SetOutfitEuiState
|
||||
{
|
||||
TargetEntityId = _target.Uid
|
||||
};
|
||||
}
|
||||
|
||||
private void AdminManagerOnPermsChanged(AdminPermsChangedEventArgs obj)
|
||||
{
|
||||
// Close UI if user loses +FUN.
|
||||
if (obj.Player == Player && !UserAdminFlagCheck(AdminFlags.Fun))
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
private bool UserAdminFlagCheck(AdminFlags flags)
|
||||
{
|
||||
return _adminManager.HasAdminFlag(Player, flags);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
155
Content.Server/Administration/Verbs/AdminAddReagentVerb.cs
Normal file
155
Content.Server/Administration/Verbs/AdminAddReagentVerb.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.EUI;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Chemistry.Solution;
|
||||
using Content.Shared.Chemistry.Solution.Components;
|
||||
using Content.Shared.Eui;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Server.Administration.Verbs
|
||||
{
|
||||
[GlobalVerb]
|
||||
internal sealed class AdminAddReagentVerb : GlobalVerb
|
||||
{
|
||||
public override bool RequireInteractionRange => false;
|
||||
public override bool BlockedByContainers => false;
|
||||
|
||||
private const AdminFlags ReqFlags = AdminFlags.Fun;
|
||||
|
||||
private static void OpenAddReagentMenu(IPlayerSession player, IEntity target)
|
||||
{
|
||||
var euiMgr = IoCManager.Resolve<EuiManager>();
|
||||
euiMgr.OpenEui(new AdminAddReagentEui(target), player);
|
||||
}
|
||||
|
||||
public override void GetData(IEntity user, IEntity target, VerbData data)
|
||||
{
|
||||
// ISolutionInteractionsComponent doesn't exactly have an interface for "admin tries to refill this", so...
|
||||
// Still have a path for SolutionContainerComponent in case it doesn't allow direct refilling.
|
||||
if (!target.HasComponent<SolutionContainerComponent>()
|
||||
&& !(target.TryGetComponent(out ISolutionInteractionsComponent? interactions)
|
||||
&& interactions.CanInject))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
}
|
||||
|
||||
data.Text = Loc.GetString("Add Reagent...");
|
||||
data.CategoryData = VerbCategories.Debug;
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
|
||||
var adminManager = IoCManager.Resolve<IAdminManager>();
|
||||
|
||||
if (user.TryGetComponent<ActorComponent>(out var player))
|
||||
{
|
||||
if (adminManager.HasAdminFlag(player.PlayerSession, ReqFlags))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Activate(IEntity user, IEntity target)
|
||||
{
|
||||
var groupController = IoCManager.Resolve<IAdminManager>();
|
||||
if (user.TryGetComponent<ActorComponent>(out var player))
|
||||
{
|
||||
if (groupController.HasAdminFlag(player.PlayerSession, ReqFlags))
|
||||
OpenAddReagentMenu(player.PlayerSession, target);
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class AdminAddReagentEui : BaseEui
|
||||
{
|
||||
private readonly IEntity _target;
|
||||
[Dependency] private readonly IAdminManager _adminManager = default!;
|
||||
|
||||
public AdminAddReagentEui(IEntity target)
|
||||
{
|
||||
_target = target;
|
||||
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
|
||||
public override void Opened()
|
||||
{
|
||||
StateDirty();
|
||||
}
|
||||
|
||||
public override EuiStateBase GetNewState()
|
||||
{
|
||||
if (_target.TryGetComponent(out SolutionContainerComponent? container))
|
||||
{
|
||||
return new AdminAddReagentEuiState
|
||||
{
|
||||
CurVolume = container.CurrentVolume,
|
||||
MaxVolume = container.MaxVolume
|
||||
};
|
||||
}
|
||||
|
||||
if (_target.TryGetComponent(out ISolutionInteractionsComponent? interactions))
|
||||
{
|
||||
return new AdminAddReagentEuiState
|
||||
{
|
||||
// We don't exactly have an absolute total volume so good enough.
|
||||
CurVolume = ReagentUnit.Zero,
|
||||
MaxVolume = interactions.InjectSpaceAvailable
|
||||
};
|
||||
}
|
||||
|
||||
return new AdminAddReagentEuiState
|
||||
{
|
||||
CurVolume = ReagentUnit.Zero,
|
||||
MaxVolume = ReagentUnit.Zero
|
||||
};
|
||||
}
|
||||
|
||||
public override void HandleMessage(EuiMessageBase msg)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case AdminAddReagentEuiMsg.Close:
|
||||
Close();
|
||||
break;
|
||||
case AdminAddReagentEuiMsg.DoAdd doAdd:
|
||||
// Double check that user wasn't de-adminned in the mean time...
|
||||
// Or the target was deleted.
|
||||
if (!_adminManager.HasAdminFlag(Player, ReqFlags) || _target.Deleted)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
var id = doAdd.ReagentId;
|
||||
var amount = doAdd.Amount;
|
||||
|
||||
if (_target.TryGetComponent(out SolutionContainerComponent? container))
|
||||
{
|
||||
container.TryAddReagent(id, amount, out _);
|
||||
}
|
||||
else if (_target.TryGetComponent(out ISolutionInteractionsComponent? interactions))
|
||||
{
|
||||
var solution = new Solution(id, amount);
|
||||
interactions.Inject(solution);
|
||||
}
|
||||
|
||||
StateDirty();
|
||||
|
||||
if (doAdd.CloseAfter)
|
||||
Close();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
56
Content.Server/Administration/Verbs/DeleteVerb.cs
Normal file
56
Content.Server/Administration/Verbs/DeleteVerb.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Administration.Verbs
|
||||
{
|
||||
[GlobalVerb]
|
||||
public class DeleteVerb : GlobalVerb
|
||||
{
|
||||
public override bool RequireInteractionRange => false;
|
||||
public override bool BlockedByContainers => false;
|
||||
|
||||
public override void GetData(IEntity user, IEntity target, VerbData data)
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
|
||||
var groupController = IoCManager.Resolve<IConGroupController>();
|
||||
|
||||
if (!user.TryGetComponent(out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!groupController.CanCommand(actor.PlayerSession, "deleteentity"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
data.Text = Loc.GetString("Delete");
|
||||
data.CategoryData = VerbCategories.Debug;
|
||||
data.Visibility = VerbVisibility.Visible;
|
||||
data.IconTexture = "/Textures/Interface/VerbIcons/delete.svg.192dpi.png";
|
||||
}
|
||||
|
||||
public override void Activate(IEntity user, IEntity target)
|
||||
{
|
||||
var groupController = IoCManager.Resolve<IConGroupController>();
|
||||
|
||||
if (!user.TryGetComponent(out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!groupController.CanCommand(actor.PlayerSession, "deleteentity"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
target.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user