Admin Ghosting
This commit is contained in:
@@ -20,6 +20,13 @@ namespace Content.Client.Input
|
|||||||
human.AddFunction(ContentKeyFunctions.UseItemInHand);
|
human.AddFunction(ContentKeyFunctions.UseItemInHand);
|
||||||
human.AddFunction(ContentKeyFunctions.ActivateItemInWorld);
|
human.AddFunction(ContentKeyFunctions.ActivateItemInWorld);
|
||||||
human.AddFunction(ContentKeyFunctions.ThrowItemInHand);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
40
Content.Server/Administration/AGhost.cs
Normal file
40
Content.Server/Administration/AGhost.cs
Normal file
@@ -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<IEntityManager>();
|
||||||
|
var ghost = entityManager.ForceSpawnEntityAt("AdminObserver",
|
||||||
|
player.AttachedEntity.Transform.LocalPosition);
|
||||||
|
|
||||||
|
mind.Visit(ghost);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,6 +63,7 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Administration\AGhost.cs" />
|
||||||
<Compile Include="AI\AimShootLifeProcessor.cs" />
|
<Compile Include="AI\AimShootLifeProcessor.cs" />
|
||||||
<Compile Include="EntryPoint.cs" />
|
<Compile Include="EntryPoint.cs" />
|
||||||
<Compile Include="GameObjects\Components\Doors\ServerDoorComponent.cs" />
|
<Compile Include="GameObjects\Components\Doors\ServerDoorComponent.cs" />
|
||||||
@@ -162,5 +163,4 @@
|
|||||||
<Compile Include="GameObjects\Components\Construction\ConstructorComponent.cs" />
|
<Compile Include="GameObjects\Components\Construction\ConstructorComponent.cs" />
|
||||||
<Compile Include="GameObjects\Components\Construction\ConstructionComponent.cs" />
|
<Compile Include="GameObjects\Components\Construction\ConstructionComponent.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -213,7 +213,7 @@ namespace Content.Server
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (data.Mind.CurrentMob == null)
|
if (data.Mind.CurrentEntity == null)
|
||||||
{
|
{
|
||||||
var mob = SpawnPlayerMob();
|
var mob = SpawnPlayerMob();
|
||||||
data.Mind.TransferTo(mob);
|
data.Mind.TransferTo(mob);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Content.Server.Mobs
|
|||||||
var mind = data.ContentData().Mind;
|
var mind = data.ContentData().Mind;
|
||||||
|
|
||||||
var builder = new StringBuilder();
|
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)
|
foreach (var role in mind.AllRoles)
|
||||||
{
|
{
|
||||||
builder.AppendFormat("{0} ", role.Name);
|
builder.AppendFormat("{0} ", role.Name);
|
||||||
|
|||||||
@@ -36,29 +36,42 @@ namespace Content.Server.Mobs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The session ID of the player owning this mind.
|
/// The session ID of the player owning this mind.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ViewVariables]
|
||||||
public NetSessionId SessionId { get; }
|
public NetSessionId SessionId { get; }
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
public bool IsVisitingEntity => VisitingEntity != null;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
public IEntity VisitingEntity { get; private set; }
|
||||||
|
|
||||||
|
[ViewVariables] public IEntity CurrentEntity => VisitingEntity ?? OwnedEntity;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The component currently owned by this mind.
|
/// The component currently owned by this mind.
|
||||||
/// Can be null.
|
/// Can be null.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MindComponent CurrentMob { get; private set; }
|
[ViewVariables]
|
||||||
|
public MindComponent OwnedMob { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The entity currently owned by this mind.
|
/// The entity currently owned by this mind.
|
||||||
/// Can be null.
|
/// Can be null.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEntity CurrentEntity => CurrentMob?.Owner;
|
[ViewVariables]
|
||||||
|
public IEntity OwnedEntity => OwnedMob?.Owner;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An enumerable over all the roles this mind has.
|
/// An enumerable over all the roles this mind has.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ViewVariables]
|
||||||
public IEnumerable<Role> AllRoles => _roles.Values;
|
public IEnumerable<Role> AllRoles => _roles.Values;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The session of the player owning this mind.
|
/// The session of the player owning this mind.
|
||||||
/// Can be null, in which case the player is currently not logged in.
|
/// Can be null, in which case the player is currently not logged in.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ViewVariables]
|
||||||
public IPlayerSession Session
|
public IPlayerSession Session
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -186,15 +199,34 @@ namespace Content.Server.Mobs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentMob?.InternalEjectMind();
|
OwnedMob?.InternalEjectMind();
|
||||||
CurrentMob = component;
|
OwnedMob = component;
|
||||||
CurrentMob?.InternalAssignMind(this);
|
OwnedMob?.InternalAssignMind(this);
|
||||||
|
|
||||||
// Player is CURRENTLY connected.
|
// Player is CURRENTLY connected.
|
||||||
if (Session != null && CurrentMob != null)
|
if (Session != null && OwnedMob != null)
|
||||||
{
|
{
|
||||||
Session.AttachToEntity(entity);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,4 +34,5 @@
|
|||||||
- me
|
- me
|
||||||
- ooc
|
- ooc
|
||||||
- showtime
|
- showtime
|
||||||
|
- aghost
|
||||||
CanViewVar: true
|
CanViewVar: true
|
||||||
|
|||||||
@@ -57,12 +57,18 @@
|
|||||||
save: false
|
save: false
|
||||||
description: Boo!
|
description: Boo!
|
||||||
components:
|
components:
|
||||||
- type: Sprite
|
|
||||||
sprite: Mob/observer.png
|
|
||||||
drawdepth: Mobs
|
|
||||||
- type: Icon
|
|
||||||
icon: Mob/observer.png
|
|
||||||
- type: Physics
|
- type: Physics
|
||||||
mass: 5
|
mass: 5
|
||||||
- type: Eye
|
- type: Eye
|
||||||
zoom: 0.5, 0.5
|
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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user