diff --git a/Content.Server/GameTicking/GamePresets/PresetSuspicion.cs b/Content.Server/GameTicking/GamePresets/PresetSuspicion.cs index eb192dbea6..4569668edc 100644 --- a/Content.Server/GameTicking/GamePresets/PresetSuspicion.cs +++ b/Content.Server/GameTicking/GamePresets/PresetSuspicion.cs @@ -9,9 +9,14 @@ using Robust.Shared.Prototypes; using Robust.Shared.Random; using System.Collections.Generic; using System.Linq; +using Content.Server.GameObjects.Components.GUI; +using Content.Server.GameObjects.Components.Items.Storage; +using Content.Server.GameObjects.Components.PDA; using Content.Server.GameObjects.Components.Suspicion; using Content.Server.Mobs.Roles; using Content.Server.Mobs.Roles.Suspicion; +using Content.Shared.GameObjects.Components.Inventory; +using Content.Shared.GameObjects.Components.PDA; using Content.Shared.Roles; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.Configuration; @@ -32,6 +37,9 @@ namespace Content.Server.GameTicking.GamePresets public int MinTraitors { get; set; } public int PlayersPerTraitor { get; set; } + public int TraitorStartingBalance { get; set; } + + public override bool DisallowLateJoin => true; private static string TraitorID = "SuspicionTraitor"; @@ -42,6 +50,7 @@ namespace Content.Server.GameTicking.GamePresets cfg.RegisterCVar("game.suspicion_min_players", 5); cfg.RegisterCVar("game.suspicion_min_traitors", 2); cfg.RegisterCVar("game.suspicion_players_per_traitor", 5); + cfg.RegisterCVar("game.suspicion_starting_balance", 20); } public override bool Start(IReadOnlyList readyPlayers, bool force = false) @@ -49,6 +58,7 @@ namespace Content.Server.GameTicking.GamePresets MinPlayers = _cfg.GetCVar("game.suspicion_min_players"); MinTraitors = _cfg.GetCVar("game.suspicion_min_traitors"); PlayersPerTraitor = _cfg.GetCVar("game.suspicion_players_per_traitor"); + TraitorStartingBalance = _cfg.GetCVar("game.suspicion_starting_balance"); if (!force && readyPlayers.Count < MinPlayers) { @@ -109,6 +119,28 @@ namespace Content.Server.GameTicking.GamePresets var traitorRole = new SuspicionTraitorRole(mind, antagPrototype); mind.AddRole(traitorRole); traitors.Add(traitorRole); + // creadth: we need to create uplink for the antag. + // PDA should be in place already, so we just need to + // initiate uplink account. + var uplinkAccount = + new UplinkAccount(mind.OwnedEntity.Uid, + TraitorStartingBalance); + var inventory = mind.OwnedEntity.GetComponent(); + if (!inventory.TryGetSlotItem(EquipmentSlotDefines.Slots.IDCARD, out ItemComponent pdaItem)) + { + continue; + } + + var pda = pdaItem.Owner; + + var pdaComponent = pda.GetComponent(); + if (pdaComponent.IdSlotEmpty) + { + continue; + } + + pdaComponent.InitUplinkAccount(uplinkAccount); + } foreach (var player in list) @@ -127,6 +159,7 @@ namespace Content.Server.GameTicking.GamePresets return true; } + public override string ModeTitle => "Suspicion"; public override string Description => "Suspicion on the Space Station. There are traitors on board... Can you kill them before they kill you?"; } diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 19383c0f37..54407dca9a 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -861,17 +861,6 @@ namespace Content.Server.GameTicking var accessTags = access.Tags; accessTags.UnionWith(jobPrototype.Access); pdaComponent.SetPDAOwner(characterName); - var mindComponent = mob.GetComponent(); - if (mindComponent.HasMind) //Redundancy checks. - { - if (mindComponent.Mind.AllRoles.Any(role => role.Antagonist)) //Give antags a new uplinkaccount. - { - var uplinkAccount = - new UplinkAccount(mob.Uid, - 20); //TODO: make me into a variable based on server pop or something. - pdaComponent.InitUplinkAccount(uplinkAccount); - } - } } private void AddManifestEntry(string characterName, string jobId)