diff --git a/Content.Client/Input/ContentContexts.cs b/Content.Client/Input/ContentContexts.cs
index 21da2fdd73..74049448a4 100644
--- a/Content.Client/Input/ContentContexts.cs
+++ b/Content.Client/Input/ContentContexts.cs
@@ -4,7 +4,7 @@ using SS14.Shared.Input;
namespace Content.Client.Input
{
///
- /// Contains a helper function for setting up all content
+ /// Contains a helper function for setting up all content
/// contexts, and modifying existing engine ones.
///
public static class ContentContexts
@@ -20,6 +20,13 @@ namespace Content.Client.Input
human.AddFunction(ContentKeyFunctions.UseItemInHand);
human.AddFunction(ContentKeyFunctions.ActivateItemInWorld);
human.AddFunction(ContentKeyFunctions.ThrowItemInHand);
+
+ var ghost = contexts.New("ghost", "common");
+ ghost.AddFunction(EngineKeyFunctions.MoveUp);
+ ghost.AddFunction(EngineKeyFunctions.MoveDown);
+ ghost.AddFunction(EngineKeyFunctions.MoveLeft);
+ ghost.AddFunction(EngineKeyFunctions.MoveRight);
+ ghost.AddFunction(EngineKeyFunctions.Run);
}
}
}
diff --git a/Content.Server/Administration/AGhost.cs b/Content.Server/Administration/AGhost.cs
new file mode 100644
index 0000000000..ba66f40d7c
--- /dev/null
+++ b/Content.Server/Administration/AGhost.cs
@@ -0,0 +1,40 @@
+using Content.Server.Players;
+using SS14.Server.Interfaces.Console;
+using SS14.Server.Interfaces.Player;
+using SS14.Shared.Interfaces.GameObjects;
+using SS14.Shared.IoC;
+
+namespace Content.Server.Administration
+{
+ public class AGhost : IClientCommand
+ {
+ public string Command => "aghost";
+ public string Description => "Makes you an admin ghost.";
+ public string Help => "aghost";
+
+ public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
+ {
+ if (player == null)
+ {
+ shell.SendText((IPlayerSession) null, "Nah");
+ return;
+ }
+
+ var mind = player.ContentData().Mind;
+ if (mind.VisitingEntity != null && mind.VisitingEntity.Prototype.ID == "AdminObserver")
+ {
+ var visiting = mind.VisitingEntity;
+ mind.UnVisit();
+ visiting.Delete();
+ }
+ else
+ {
+ var entityManager = IoCManager.Resolve();
+ var ghost = entityManager.ForceSpawnEntityAt("AdminObserver",
+ player.AttachedEntity.Transform.LocalPosition);
+
+ mind.Visit(ghost);
+ }
+ }
+ }
+}
diff --git a/Content.Server/Content.Server.csproj b/Content.Server/Content.Server.csproj
index acffbfbe39..8da4a3565c 100644
--- a/Content.Server/Content.Server.csproj
+++ b/Content.Server/Content.Server.csproj
@@ -63,6 +63,7 @@
+
@@ -162,5 +163,4 @@
-
-
+
\ No newline at end of file
diff --git a/Content.Server/EntryPoint.cs b/Content.Server/EntryPoint.cs
index efd45c2f13..974015ee5e 100644
--- a/Content.Server/EntryPoint.cs
+++ b/Content.Server/EntryPoint.cs
@@ -213,7 +213,7 @@ namespace Content.Server
}
else
{
- if (data.Mind.CurrentMob == null)
+ if (data.Mind.CurrentEntity == null)
{
var mob = SpawnPlayerMob();
data.Mind.TransferTo(mob);
diff --git a/Content.Server/Mobs/Commands.cs b/Content.Server/Mobs/Commands.cs
index a29207cb3b..4fabec1d00 100644
--- a/Content.Server/Mobs/Commands.cs
+++ b/Content.Server/Mobs/Commands.cs
@@ -34,7 +34,7 @@ namespace Content.Server.Mobs
var mind = data.ContentData().Mind;
var builder = new StringBuilder();
- builder.AppendFormat("player: {0}, mob: {1}\nroles: ", mind.SessionId, mind.CurrentMob?.Owner?.Uid);
+ builder.AppendFormat("player: {0}, mob: {1}\nroles: ", mind.SessionId, mind.OwnedMob?.Owner?.Uid);
foreach (var role in mind.AllRoles)
{
builder.AppendFormat("{0} ", role.Name);
diff --git a/Content.Server/Mobs/Mind.cs b/Content.Server/Mobs/Mind.cs
index 4809ec3dcc..b7ab5aaf8b 100644
--- a/Content.Server/Mobs/Mind.cs
+++ b/Content.Server/Mobs/Mind.cs
@@ -36,29 +36,42 @@ namespace Content.Server.Mobs
///
/// The session ID of the player owning this mind.
///
+ [ViewVariables]
public NetSessionId SessionId { get; }
+ [ViewVariables]
+ public bool IsVisitingEntity => VisitingEntity != null;
+
+ [ViewVariables]
+ public IEntity VisitingEntity { get; private set; }
+
+ [ViewVariables] public IEntity CurrentEntity => VisitingEntity ?? OwnedEntity;
+
///
/// The component currently owned by this mind.
/// Can be null.
///
- public MindComponent CurrentMob { get; private set; }
+ [ViewVariables]
+ public MindComponent OwnedMob { get; private set; }
///
/// The entity currently owned by this mind.
/// Can be null.
///
- public IEntity CurrentEntity => CurrentMob?.Owner;
+ [ViewVariables]
+ public IEntity OwnedEntity => OwnedMob?.Owner;
///
/// An enumerable over all the roles this mind has.
///
+ [ViewVariables]
public IEnumerable AllRoles => _roles.Values;
///
/// The session of the player owning this mind.
/// Can be null, in which case the player is currently not logged in.
///
+ [ViewVariables]
public IPlayerSession Session
{
get
@@ -186,15 +199,34 @@ namespace Content.Server.Mobs
}
}
- CurrentMob?.InternalEjectMind();
- CurrentMob = component;
- CurrentMob?.InternalAssignMind(this);
+ OwnedMob?.InternalEjectMind();
+ OwnedMob = component;
+ OwnedMob?.InternalAssignMind(this);
// Player is CURRENTLY connected.
- if (Session != null && CurrentMob != null)
+ if (Session != null && OwnedMob != null)
{
Session.AttachToEntity(entity);
}
+
+ VisitingEntity = null;
+ }
+
+ public void Visit(IEntity entity)
+ {
+ Session?.AttachToEntity(entity);
+ VisitingEntity = entity;
+ }
+
+ public void UnVisit()
+ {
+ if (!IsVisitingEntity)
+ {
+ return;
+ }
+
+ Session?.AttachToEntity(OwnedEntity);
+ VisitingEntity = null;
}
}
}
diff --git a/Resources/Groups/groups.yml b/Resources/Groups/groups.yml
index 105a543872..5ed71d7afc 100644
--- a/Resources/Groups/groups.yml
+++ b/Resources/Groups/groups.yml
@@ -34,4 +34,5 @@
- me
- ooc
- showtime
+ - aghost
CanViewVar: true
diff --git a/Resources/Prototypes/Entities/Mobs.yml b/Resources/Prototypes/Entities/Mobs.yml
index 6da95f0ee2..0b97100ae1 100644
--- a/Resources/Prototypes/Entities/Mobs.yml
+++ b/Resources/Prototypes/Entities/Mobs.yml
@@ -57,12 +57,18 @@
save: false
description: Boo!
components:
- - type: Sprite
- sprite: Mob/observer.png
- drawdepth: Mobs
- - type: Icon
- icon: Mob/observer.png
- type: Physics
mass: 5
- type: Eye
zoom: 0.5, 0.5
+ - type: BoundingBox
+ aabb: "-0.5,-0.25,-0.05,0.25"
+ - type: Input
+ context: "ghost"
+
+
+- type: entity
+ parent: MobObserver
+ save: false
+ id: AdminObserver
+