Antag preferences and antag prototype (#1264)

Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
ike709
2020-07-06 16:24:29 -05:00
committed by GitHub
parent cee8aaa84c
commit c019d428a7
42 changed files with 833 additions and 50 deletions

View File

@@ -26,7 +26,7 @@ namespace Content.Server.Mobs
/// <summary>
/// Whether this role should be considered antagonistic or not.
/// </summary>
public abstract bool Antag { get; }
public abstract bool Antagonist { get; }
protected Role(Mind mind)
{

View File

@@ -11,7 +11,7 @@ namespace Content.Server.Mobs.Roles
public JobPrototype Prototype { get; }
public override string Name { get; }
public override bool Antag => false;
public override bool Antagonist => false;
public string StartingGear => Prototype.StartingGear;

View File

@@ -2,24 +2,32 @@ using Content.Server.GameObjects;
using Content.Server.Interfaces.Chat;
using Robust.Shared.IoC;
using Robust.Shared.Utility;
using Content.Shared.Antags;
namespace Content.Server.Mobs.Roles
{
public class SuspicionInnocentRole : Role
{
public SuspicionInnocentRole(Mind mind) : base(mind)
public AntagPrototype Prototype { get; }
public SuspicionInnocentRole(Mind mind, AntagPrototype antagPrototype) : base(mind)
{
Prototype = antagPrototype;
Name = antagPrototype.Name;
Antagonist = antagPrototype.Antagonist;
}
public override string Name => "Innocent";
public override bool Antag => false;
public override string Name { get; }
public string Objective => Prototype.Objective;
public override bool Antagonist { get; }
public override void Greet()
{
base.Greet();
var chat = IoCManager.Resolve<IChatManager>();
chat.DispatchServerMessage(Mind.Session, "You're an innocent!");
chat.DispatchServerMessage(Mind.Session, $"You're a {Name}!");
chat.DispatchServerMessage(Mind.Session, $"Objective: {Objective}");
}
}
}

View File

@@ -1,25 +1,33 @@
using Content.Server.GameObjects;
using Content.Server.GameObjects;
using Content.Server.Interfaces.Chat;
using Robust.Shared.IoC;
using Robust.Shared.Utility;
using Content.Shared.Antags;
namespace Content.Server.Mobs.Roles
{
public sealed class SuspicionTraitorRole : Role
{
public SuspicionTraitorRole(Mind mind) : base(mind)
public AntagPrototype Prototype { get; }
public SuspicionTraitorRole(Mind mind, AntagPrototype antagPrototype) : base(mind)
{
Prototype = antagPrototype;
Name = antagPrototype.Name;
Antagonist = antagPrototype.Antagonist;
}
public override string Name => "Traitor";
public override bool Antag => true;
public override string Name { get; }
public string Objective => Prototype.Objective;
public override bool Antagonist { get; }
public override void Greet()
{
base.Greet();
var chat = IoCManager.Resolve<IChatManager>();
chat.DispatchServerMessage(Mind.Session, "You're a traitor!");
chat.DispatchServerMessage(Mind.Session, $"You're a {Name}!");
chat.DispatchServerMessage(Mind.Session, $"Objective: {Objective}");
}
}
}