Traitor (#2566)
* basic implementation * minor fixes * objectives temp commit * proper onstart bind * changes all conditions to be bound to a mind-instance * oops * oops v2 * adds possiblity to enable duplicate assignment of objective equal objectives are unable to be added * minor fixes, adds greentext * refactors incompatability to be defined by requirements * fixes a wrong whitespace * minor fix * addressed reviews v1 * address reviews v2 Co-authored-by: Exp <theexp111@gmail.com> * final sweep * adds/refactors traitor&sss cvars * Update Content.Server/Mobs/Mind.cs * never trust github web * adds datasets & makes codewords use them * addresses exp's reviews * addressed zumos reviews Co-authored-by: Paul <ritter.paul1+git@googlemail.com> Co-authored-by: Exp <theexp111@gmail.com>
This commit is contained in:
@@ -28,7 +28,7 @@ namespace Content.Server.Mobs
|
||||
{
|
||||
private readonly ISet<Role> _roles = new HashSet<Role>();
|
||||
|
||||
private readonly List<ObjectivePrototype> _objectives = new();
|
||||
private readonly List<Objective> _objectives = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates the new mind attached to a specific player session.
|
||||
@@ -81,7 +81,7 @@ namespace Content.Server.Mobs
|
||||
/// An enumerable over all the objectives this mind has.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public IEnumerable<ObjectivePrototype> AllObjectives => _objectives;
|
||||
public IEnumerable<Objective> AllObjectives => _objectives;
|
||||
|
||||
/// <summary>
|
||||
/// The session of the player owning this mind.
|
||||
@@ -156,9 +156,12 @@ namespace Content.Server.Mobs
|
||||
/// <summary>
|
||||
/// Adds an objective to this mind.
|
||||
/// </summary>
|
||||
public bool TryAddObjective(ObjectivePrototype objective)
|
||||
public bool TryAddObjective(ObjectivePrototype objectivePrototype)
|
||||
{
|
||||
if (!objective.CanBeAssigned(this))
|
||||
if (!objectivePrototype.CanBeAssigned(this))
|
||||
return false;
|
||||
var objective = objectivePrototype.GetObjective(this);
|
||||
if (_objectives.Contains(objective))
|
||||
return false;
|
||||
_objectives.Add(objective);
|
||||
return true;
|
||||
|
||||
23
Content.Server/Mobs/Roles/Traitor/TraitorRole.cs
Normal file
23
Content.Server/Mobs/Roles/Traitor/TraitorRole.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Mobs.Roles.Traitor
|
||||
{
|
||||
public class TraitorRole : Role
|
||||
{
|
||||
public TraitorRole(Mind mind) : base(mind)
|
||||
{
|
||||
}
|
||||
|
||||
public override string Name => "Syndicate Agent";
|
||||
public override bool Antagonist => true;
|
||||
|
||||
public void GreetTraitor(string[] codewords)
|
||||
{
|
||||
var chatMgr = IoCManager.Resolve<IChatManager>();
|
||||
chatMgr.DispatchServerMessage(Mind.Session, Loc.GetString("Hello Agent!"));
|
||||
chatMgr.DispatchServerMessage(Mind.Session, Loc.GetString("Your codewords are: {0}", string.Join(", ",codewords)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user