Suspicion on the Space Station gamemode (#849)

This commit is contained in:
Víctor Aguilera Puerto
2020-05-03 11:25:39 +02:00
committed by GitHub
parent ccbe4bc23f
commit 5d7514674e
15 changed files with 305 additions and 48 deletions

View File

@@ -1,12 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Players;
using Robust.Server.Interfaces.GameObjects;
using Robust.Server.Interfaces.Player;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Network;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
namespace Content.Server.Mobs
@@ -130,6 +133,13 @@ namespace Content.Server.Mobs
_roles.Remove(role);
}
public bool HasRole<T>() where T : Role
{
var t = typeof(T);
return _roles.Any(role => role.GetType() == t);
}
/// <summary>
/// Transfer this mind's control over to a new entity.
/// </summary>

View File

@@ -1,6 +1,9 @@
// Hey look,
// Antag Datums.
using Content.Server.GameObjects.EntitySystems;
using Robust.Shared.Utility;
namespace Content.Server.Mobs
{
/// <summary>
@@ -20,6 +23,11 @@ namespace Content.Server.Mobs
/// </summary>
public abstract string Name { get; }
/// <summary>
/// Whether this role should be considered antagonistic or not.
/// </summary>
public abstract bool Antag { get; }
protected Role(Mind mind)
{
Mind = mind;

View File

@@ -11,8 +11,9 @@ namespace Content.Server.Mobs.Roles
public JobPrototype Prototype { get; }
public override string Name { get; }
public override bool Antag => false;
public String StartingGear => Prototype.StartingGear;
public string StartingGear => Prototype.StartingGear;
public Job(Mind mind, JobPrototype jobPrototype) : base(mind)
{
@@ -25,9 +26,7 @@ namespace Content.Server.Mobs.Roles
base.Greet();
var chat = IoCManager.Resolve<IChatManager>();
chat.DispatchServerMessage(
Mind.Session,
String.Format("You're a new {0}. Do your best!", Name));
chat.DispatchServerMessage(Mind.Session, $"You're a new {Name}. Do your best!");
}
}

View File

@@ -0,0 +1,25 @@
using Content.Server.GameObjects;
using Content.Server.Interfaces.Chat;
using Robust.Shared.IoC;
using Robust.Shared.Utility;
namespace Content.Server.Mobs.Roles
{
public class SuspicionInnocentRole : Role
{
public SuspicionInnocentRole(Mind mind) : base(mind)
{
}
public override string Name => "Innocent";
public override bool Antag => false;
public override void Greet()
{
base.Greet();
var chat = IoCManager.Resolve<IChatManager>();
chat.DispatchServerMessage(Mind.Session, "You're an innocent!");
}
}
}

View File

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

View File

@@ -1,24 +0,0 @@
using Content.Server.Interfaces.Chat;
using Robust.Shared.IoC;
namespace Content.Server.Mobs.Roles
{
public sealed class Traitor : Role
{
public Traitor(Mind mind) : base(mind)
{
}
public override string Name => "Traitor";
public override void Greet()
{
base.Greet();
var chat = IoCManager.Resolve<IChatManager>();
chat.DispatchServerMessage(
Mind.Session,
"You're a traitor. Go fuck something up. Or something. I don't care to be honest.");
}
}
}