uplink ringtone code + minor cleanup (#15277)

* uplink ringtone code + minor cleanup

* show uplink code in character menu

* no log

* rgbee

* no red

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-04-23 21:00:42 +00:00
committed by GitHub
parent 8adff42250
commit 597c398545
7 changed files with 85 additions and 87 deletions

View File

@@ -1,12 +1,13 @@
using System.Linq;
using Content.Server.Chat.Managers;
using Content.Server.NPC.Systems;
using Content.Server.Objectives.Interfaces;
using Content.Server.PDA.Ringer;
using Content.Server.Players;
using Content.Server.Roles;
using Content.Server.Shuttles.Components;
using Content.Server.Traitor;
using Content.Server.Traitor.Uplink;
using Content.Server.NPC.Systems;
using Content.Server.Shuttles.Components;
using Content.Shared.CCVar;
using Content.Shared.Dataset;
using Content.Shared.Preferences;
@@ -18,8 +19,8 @@ using Robust.Shared.Configuration;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
namespace Content.Server.GameTicking.Rules;
@@ -249,14 +250,18 @@ public sealed class TraitorRuleSystem : GameRuleSystem
if (mind.CurrentJob != null)
startingBalance = Math.Max(startingBalance - mind.CurrentJob.Prototype.AntagAdvantage, 0);
if (!_uplink.AddUplink(mind.OwnedEntity!.Value, startingBalance))
var pda = _uplink.FindUplinkTarget(mind.OwnedEntity!.Value);
if (pda == null || !_uplink.AddUplink(mind.OwnedEntity.Value, startingBalance))
return false;
// add the ringtone uplink and get its code for greeting
var code = AddComp<RingerUplinkComponent>(pda.Value).Code;
var antagPrototype = _prototypeManager.Index<AntagPrototype>(TraitorPrototypeID);
var traitorRole = new TraitorRole(mind, antagPrototype);
mind.AddRole(traitorRole);
Traitors.Add(traitorRole);
traitorRole.GreetTraitor(Codewords);
traitorRole.GreetTraitor(Codewords, code);
_faction.RemoveFaction(entity, "NanoTrasen", false);
_faction.AddFaction(entity, "Syndicate");
@@ -274,8 +279,9 @@ public sealed class TraitorRuleSystem : GameRuleSystem
difficulty += objective.Difficulty;
}
//give traitors their codewords to keep in their character info menu
traitorRole.Mind.Briefing = Loc.GetString("traitor-role-codewords", ("codewords", string.Join(", ", Codewords)));
//give traitors their codewords and uplink code to keep in their character info menu
traitorRole.Mind.Briefing = Loc.GetString("traitor-role-codewords-short", ("codewords", string.Join(", ", Codewords)))
+ "\n" + Loc.GetString("traitor-role-uplink-code-short", ("code", string.Join("", code)));
_audioSystem.PlayGlobal(_addedSound, Filter.Empty().AddPlayer(traitor), false, AudioParams.Default);
return true;