Merge pull request #829 from Zumorica/2020-04-20-mind-examine-message
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
using Content.Server.GameObjects.Components.Observer;
|
using Content.Server.GameObjects.Components.Observer;
|
||||||
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Mobs;
|
using Content.Server.Mobs;
|
||||||
|
using Content.Server.Players;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Mobs
|
namespace Content.Server.GameObjects.Components.Mobs
|
||||||
@@ -10,8 +14,10 @@ namespace Content.Server.GameObjects.Components.Mobs
|
|||||||
/// Stores a <see cref="Server.Mobs.Mind"/> on a mob.
|
/// Stores a <see cref="Server.Mobs.Mind"/> on a mob.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class MindComponent : Component
|
public class MindComponent : Component, IExamine
|
||||||
{
|
{
|
||||||
|
private bool _showExamineInfo = false;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Mind";
|
public override string Name => "Mind";
|
||||||
|
|
||||||
@@ -27,6 +33,16 @@ namespace Content.Server.GameObjects.Components.Mobs
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool HasMind => Mind != null;
|
public bool HasMind => Mind != null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether examining should show information about the mind or not.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool ShowExamineInfo
|
||||||
|
{
|
||||||
|
get => _showExamineInfo;
|
||||||
|
set => _showExamineInfo = value;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't call this unless you know what the hell you're doing.
|
/// Don't call this unless you know what the hell you're doing.
|
||||||
/// Use <see cref="Mind.TransferTo(IEntity)"/> instead.
|
/// Use <see cref="Mind.TransferTo(IEntity)"/> instead.
|
||||||
@@ -74,5 +90,23 @@ namespace Content.Server.GameObjects.Components.Mobs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
|
{
|
||||||
|
base.ExposeData(serializer);
|
||||||
|
serializer.DataField(ref _showExamineInfo, "show_examine_info", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Examine(FormattedMessage message)
|
||||||
|
{
|
||||||
|
if (!ShowExamineInfo)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// TODO: Use gendered pronouns depending on the entity
|
||||||
|
if(!HasMind)
|
||||||
|
message.AddMarkup($"[color=red]They are totally catatonic. The stresses of life in deep-space must have been too much for them. Any recovery is unlikely.[/color]");
|
||||||
|
else if(Mind.Session == null)
|
||||||
|
message.AddMarkup("[color=yellow]They have a blank, absent-minded stare and appears completely unresponsive to anything. They may snap out of it soon.[/color]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
drawdepth: Mobs
|
drawdepth: Mobs
|
||||||
components:
|
components:
|
||||||
- type: Mind
|
- type: Mind
|
||||||
|
show_examine_info: true
|
||||||
- type: Hands
|
- type: Hands
|
||||||
hands:
|
hands:
|
||||||
- left
|
- left
|
||||||
|
|||||||
Reference in New Issue
Block a user