Files
tbd-station-14/Content.Server/GameTicking/GameRules/RuleTraitor.cs
Paul Ritter f7c09fbd7e 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>
2020-12-01 17:05:19 +01:00

37 lines
1.3 KiB
C#

using System;
using System.Threading;
using Content.Server.Interfaces.Chat;
using Content.Server.Interfaces.GameTicking;
using Content.Server.Mobs.Roles.Traitor;
using Content.Server.Players;
using Content.Shared;
using Content.Shared.GameObjects.Components.Damage;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.Player;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.Configuration;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Timer = Robust.Shared.Timers.Timer;
namespace Content.Server.GameTicking.GameRules
{
public class RuleTraitor : GameRule
{
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IGameTicker _gameTicker = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
public override void Added()
{
_chatManager.DispatchServerAnnouncement(Loc.GetString("Hello crew! Have a good shift!"));
bool Predicate(IPlayerSession session) => session.ContentData()?.Mind?.HasRole<TraitorRole>() ?? false;
EntitySystem.Get<AudioSystem>().PlayGlobal("/Audio/Misc/tatoralert.ogg", AudioParams.Default, Predicate);
}
}
}