2020-02-24 03:49:40 +01:00
|
|
|
using Content.Server.GameObjects;
|
|
|
|
|
using Content.Server.GameObjects.Components.Mobs;
|
|
|
|
|
using Content.Server.GameObjects.Components.Nutrition;
|
2020-04-17 19:28:08 +02:00
|
|
|
using Content.Server.GameObjects.Components.Observer;
|
2020-02-24 03:49:40 +01:00
|
|
|
using Content.Server.Players;
|
|
|
|
|
using Content.Shared.GameObjects;
|
|
|
|
|
using Robust.Server.Console;
|
|
|
|
|
using Robust.Server.Interfaces.GameObjects;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
using Robust.Shared.Log;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.GlobalVerbs
|
|
|
|
|
{
|
|
|
|
|
[GlobalVerb]
|
|
|
|
|
public class ControlMobVerb : GlobalVerb
|
|
|
|
|
{
|
|
|
|
|
public override string GetText(IEntity user, IEntity target) => "Control Mob";
|
2020-03-06 20:11:24 +01:00
|
|
|
public override string GetCategory(IEntity user, IEntity target) => "Debug";
|
|
|
|
|
|
2020-02-24 03:49:40 +01:00
|
|
|
public override bool RequireInteractionRange => false;
|
|
|
|
|
|
|
|
|
|
public override VerbVisibility GetVisibility(IEntity user, IEntity target)
|
|
|
|
|
{
|
|
|
|
|
var groupController = IoCManager.Resolve<IConGroupController>();
|
|
|
|
|
if (user == target) return VerbVisibility.Invisible;
|
|
|
|
|
|
|
|
|
|
if (user.TryGetComponent<IActorComponent>(out var player))
|
|
|
|
|
{
|
|
|
|
|
if (!user.HasComponent<MindComponent>() || !target.HasComponent<MindComponent>())
|
|
|
|
|
return VerbVisibility.Invisible;
|
|
|
|
|
|
|
|
|
|
if (groupController.CanCommand(player.playerSession, "controlmob"))
|
|
|
|
|
return VerbVisibility.Visible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return VerbVisibility.Invisible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Activate(IEntity user, IEntity target)
|
|
|
|
|
{
|
|
|
|
|
var userMind = user.GetComponent<IActorComponent>().playerSession.ContentData().Mind;
|
|
|
|
|
var targetMind = target.GetComponent<MindComponent>();
|
2020-04-17 19:28:08 +02:00
|
|
|
var oldEntity = userMind.CurrentEntity;
|
2020-02-24 03:49:40 +01:00
|
|
|
|
|
|
|
|
targetMind.Mind?.TransferTo(null);
|
|
|
|
|
userMind.TransferTo(target);
|
2020-04-17 19:28:08 +02:00
|
|
|
|
|
|
|
|
if(oldEntity.HasComponent<GhostComponent>())
|
|
|
|
|
oldEntity.Delete();
|
2020-02-24 03:49:40 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|