From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Wed, 27 Dec 2023 20:42:15 +0000 (+0300) Subject: Thief hotfix (#22976) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=166296b2c510a81cdf3a11636a296b1ad859ed85;p=space-station-14.git Thief hotfix (#22976) * fixes! * reduced collection amount * omeeeeega * pipup * popup --- diff --git a/Content.Client/Thief/ThiefBackpackBoundUserInterface.cs b/Content.Client/Thief/ThiefBackpackBoundUserInterface.cs index 2d492c5e1b..37384daafe 100644 --- a/Content.Client/Thief/ThiefBackpackBoundUserInterface.cs +++ b/Content.Client/Thief/ThiefBackpackBoundUserInterface.cs @@ -26,8 +26,10 @@ public sealed class ThiefBackpackBoundUserInterface : BoundUserInterface if (!disposing) return; + if (_window != null) + _window.OnClose -= Close; + _window?.Dispose(); - _window = null; } protected override void UpdateState(BoundUserInterfaceState state) diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs b/Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs index 6840651c57..5a436d390a 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs @@ -132,7 +132,7 @@ public sealed partial class AdminVerbSystem if (!_minds.TryGetSession(targetMindComp.Mind, out var session)) return; - _thief.MakeThief(session, false); //Midround add pacific is bad + _thief.AdminMakeThief(session, false); //Midround add pacific is bad }, Impact = LogImpact.High, Message = Loc.GetString("admin-verb-make-thief"), diff --git a/Content.Server/GameTicking/Rules/Components/ThiefRuleComponent.cs b/Content.Server/GameTicking/Rules/Components/ThiefRuleComponent.cs index a7ad4e2d20..01ca9df114 100644 --- a/Content.Server/GameTicking/Rules/Components/ThiefRuleComponent.cs +++ b/Content.Server/GameTicking/Rules/Components/ThiefRuleComponent.cs @@ -15,6 +15,7 @@ public sealed partial class ThiefRuleComponent : Component /// /// Add a Pacified comp to thieves /// + [DataField] public bool PacifistThieves = true; /// @@ -41,9 +42,10 @@ public sealed partial class ThiefRuleComponent : Component public List StarterItems = new List { "ToolboxThief", "ClothingHandsChameleonThief" }; //TO DO - replace to chameleon thieving gloves whem merg /// - /// All Thiefes created by this rule + /// All Thieves created by this rule /// - public readonly List ThiefMinds = new(); + [DataField] + public List ThievesMinds = new(); /// /// Max Thiefs created by rule on roundstart diff --git a/Content.Server/GameTicking/Rules/ThiefRuleSystem.cs b/Content.Server/GameTicking/Rules/ThiefRuleSystem.cs index 9a447f51d2..27e0cb592d 100644 --- a/Content.Server/GameTicking/Rules/ThiefRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/ThiefRuleSystem.cs @@ -2,11 +2,9 @@ using Content.Server.Chat.Managers; using Content.Server.GameTicking.Rules.Components; using Content.Server.Mind; using Content.Server.Objectives; -using Content.Server.Shuttles.Components; using Content.Server.Roles; using Content.Shared.Mind; using Content.Shared.Objectives.Components; -using Content.Shared.Preferences; using Content.Shared.Roles; using Content.Shared.Roles.Jobs; using Robust.Shared.Player; @@ -17,24 +15,26 @@ using Content.Shared.Humanoid; using Content.Server.Antag; using Robust.Server.Audio; using Content.Shared.CombatMode.Pacification; +using Content.Shared.Random; namespace Content.Server.GameTicking.Rules; public sealed class ThiefRuleSystem : GameRuleSystem { [Dependency] private readonly IChatManager _chatManager = default!; - [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly AntagSelectionSystem _antagSelection = default!; [Dependency] private readonly AudioSystem _audio = default!; [Dependency] private readonly MindSystem _mindSystem = default!; [Dependency] private readonly SharedRoleSystem _roleSystem = default!; - [Dependency] private readonly SharedJobSystem _jobs = default!; [Dependency] private readonly ObjectivesSystem _objectives = default!; - const string bigObjectiveGroup = "ThiefBigObjectiveGroups"; - const string smallObjectiveGroup = "ThiefObjectiveGroups"; - const string escapeObjectiveGroup = "ThiefEscapeObjectiveGroups"; + [ValidatePrototypeId] + const string BigObjectiveGroup = "ThiefBigObjectiveGroups"; + [ValidatePrototypeId] + const string SmallObjectiveGroup = "ThiefObjectiveGroups"; + [ValidatePrototypeId] + const string EscapeObjectiveGroup = "ThiefEscapeObjectiveGroups"; private const float BigObjectiveChance = 0.7f; public override void Initialize() @@ -52,24 +52,21 @@ public sealed class ThiefRuleSystem : GameRuleSystem var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var thief, out var gameRule)) { - //Chance to not lauch gamerule - if (!_random.Prob(thief.RuleChance)) + //Chance to not lauch gamerule + if (_random.Prob(thief.RuleChance)) { - RemComp(uid); - continue; - } - - if (!GameTicker.IsGameRuleAdded(uid, gameRule)) - continue; - - foreach (var player in ev.Players) - { - if (!ev.Profiles.ContainsKey(player.UserId)) + if (!GameTicker.IsGameRuleAdded(uid, gameRule)) continue; - thief.StartCandidates[player] = ev.Profiles[player.UserId]; + foreach (var player in ev.Players) + { + if (!ev.Profiles.TryGetValue(player.UserId, out var profile)) + continue; + + thief.StartCandidates[player] = profile; + } + DoThiefStart(thief); } - DoThiefStart(thief); } } @@ -88,19 +85,12 @@ public sealed class ThiefRuleSystem : GameRuleSystem foreach(var thief in selectedThieves) { - MakeThief(thief, component.PacifistThieves); + MakeThief(component, thief, component.PacifistThieves); } } - public bool MakeThief(ICommonSession thief, bool AddPacified) + public bool MakeThief(ThiefRuleComponent thiefRule, ICommonSession thief, bool addPacified) { - var thiefRule = EntityQuery().FirstOrDefault(); - if (thiefRule == null) - { - GameTicker.StartGameRule("Thief", out var ruleEntity); - thiefRule = Comp(ruleEntity); - } - //checks if (!_mindSystem.TryGetMind(thief, out var mindId, out var mind)) { @@ -124,9 +114,12 @@ public sealed class ThiefRuleSystem : GameRuleSystem PrototypeId = thiefRule.ThiefPrototypeId }); - //Add Pacified - if (AddPacified) + //Add Pacified + //To Do: Long-term this should just be using the antag code to add components. + if (addPacified) //This check is important because some servers may want to disable the thief's pacifism. Do not remove. + { EnsureComp(mind.OwnedEntity.Value); + } // Notificate player about new role assignment if (_mindSystem.TryGetSession(mindId, out var session)) @@ -140,7 +133,7 @@ public sealed class ThiefRuleSystem : GameRuleSystem if (_random.Prob(BigObjectiveChance)) // 70% chance to 1 big objective (structure or animal) { - var objective = _objectives.GetRandomObjective(mindId, mind, bigObjectiveGroup); + var objective = _objectives.GetRandomObjective(mindId, mind, BigObjectiveGroup); if (objective != null) { _mindSystem.AddObjective(mindId, mind, objective.Value); @@ -150,7 +143,7 @@ public sealed class ThiefRuleSystem : GameRuleSystem for (var i = 0; i < thiefRule.MaxStealObjectives && thiefRule.MaxObjectiveDifficulty > difficulty; i++) // Many small objectives { - var objective = _objectives.GetRandomObjective(mindId, mind, smallObjectiveGroup); + var objective = _objectives.GetRandomObjective(mindId, mind, SmallObjectiveGroup); if (objective == null) continue; @@ -159,17 +152,29 @@ public sealed class ThiefRuleSystem : GameRuleSystem } //Escape target - var escapeObjective = _objectives.GetRandomObjective(mindId, mind, escapeObjectiveGroup); + var escapeObjective = _objectives.GetRandomObjective(mindId, mind, EscapeObjectiveGroup); if (escapeObjective != null) _mindSystem.AddObjective(mindId, mind, escapeObjective.Value); // Give starting items _antagSelection.GiveAntagBagGear(mind.OwnedEntity.Value, thiefRule.StarterItems); - thiefRule.ThiefMinds.Add(mindId); + thiefRule.ThievesMinds.Add(mindId); return true; } + public void AdminMakeThief(ICommonSession thief, bool addPacified) + { + var thiefRule = EntityQuery().FirstOrDefault(); + if (thiefRule == null) + { + GameTicker.StartGameRule("Thief", out var ruleEntity); + thiefRule = Comp(ruleEntity); + } + + MakeThief(thiefRule, thief, addPacified); + } + //Add mind briefing private void OnGetBriefing(Entity thief, ref GetBriefingEvent args) { @@ -193,7 +198,7 @@ public sealed class ThiefRuleSystem : GameRuleSystem private void OnObjectivesTextGetInfo(Entity thiefs, ref ObjectivesTextGetInfoEvent args) { - args.Minds = thiefs.Comp.ThiefMinds; + args.Minds = thiefs.Comp.ThievesMinds; args.AgentName = Loc.GetString("thief-round-end-agent-name"); } } diff --git a/Content.Server/Thief/Components/ThiefUndeterminedBackpackComponent.cs b/Content.Server/Thief/Components/ThiefUndeterminedBackpackComponent.cs index c39807414a..edea8f5273 100644 --- a/Content.Server/Thief/Components/ThiefUndeterminedBackpackComponent.cs +++ b/Content.Server/Thief/Components/ThiefUndeterminedBackpackComponent.cs @@ -1,3 +1,4 @@ +using Content.Server.Thief.Systems; using Content.Shared.Thief; using Robust.Shared.Audio; using Robust.Shared.Prototypes; @@ -8,7 +9,7 @@ namespace Content.Server.Thief.Components; /// This component stores the possible contents of the backpack, /// which can be selected via the interface. /// -[RegisterComponent] +[RegisterComponent, Access(typeof(ThiefUndeterminedBackpackSystem))] public sealed partial class ThiefUndeterminedBackpackComponent : Component { /// diff --git a/Content.Server/Thief/Systems/ThiefUndeterminedBackpackSystem.cs b/Content.Server/Thief/Systems/ThiefUndeterminedBackpackSystem.cs index 99cbcfa07c..9918565328 100644 --- a/Content.Server/Thief/Systems/ThiefUndeterminedBackpackSystem.cs +++ b/Content.Server/Thief/Systems/ThiefUndeterminedBackpackSystem.cs @@ -6,6 +6,11 @@ using Robust.Server.Audio; using Robust.Shared.Prototypes; namespace Content.Server.Thief.Systems; + +/// +/// +/// this system links the interface to the logic, and will output to the player a set of items selected by him in the interface +/// public sealed class ThiefUndeterminedBackpackSystem : EntitySystem { [Dependency] private readonly AudioSystem _audio = default!; @@ -44,7 +49,7 @@ public sealed class ThiefUndeterminedBackpackSystem : EntitySystem } } _audio.PlayPvs(backpack.Comp.ApproveSound, backpack.Owner); - QueueDel(backpack); //hehe + QueueDel(backpack); } private void OnChangeSet(Entity backpack, ref ThiefBackpackChangeSetMessage args) { diff --git a/Resources/Locale/en-US/thief/backpack.ftl b/Resources/Locale/en-US/thief/backpack.ftl index a09c3e9ee3..31b87c6f02 100644 --- a/Resources/Locale/en-US/thief/backpack.ftl +++ b/Resources/Locale/en-US/thief/backpack.ftl @@ -3,7 +3,7 @@ thief-backpack-window-title = thief toolbox thief-backpack-window-description = This toolbox is filled with unspecified contents. Now you need to remember what you put in it. - Choose up to two different sets from the list. + Choose 2 different sets from the list. thief-backpack-window-selected = Kits selected: ({$selectedCount}/{$maxCount}) @@ -32,12 +32,13 @@ thief-backpack-category-chemistry-description = A set for those who love to improve their body. It includes a storage implanter, a DNA scrambler implanter, - and a set of chemicals for a rainy day. + a set of chemicals for a rainy day, + and omega soap. thief-backpack-category-syndie-name = syndie kit thief-backpack-category-syndie-description = A set of items from a syndicate agent you've robbed - in the past. Includes an Agent ID card, a syndicate pAI, + in the past. Includes an Agent ID card, Emag, a syndicate pAI, and some strange red crystals. thief-backpack-category-sleeper-name = sleepwalker's kit @@ -50,13 +51,13 @@ thief-backpack-category-sleeper-description = thief-backpack-category-communicator-name = communicator's kit thief-backpack-category-communicator-description = A communication enthusiast's kit. Includes a master key - for all station channels, a radio jammer, a portable + for all station channels, a cybersun pen, a portable crew monitor, a voice chameleon mask and lots of money for business deals. thief-backpack-category-smuggler-name = smuggler's kit thief-backpack-category-smuggler-description = A kit for those who like to have big pockets. - Includes a fulton beacon, ten fultons + Includes a fulton beacon, ten fultons, 3 smoke grenades and an invisible crate. You can't move in them, but you can quickly hide or carry valuable loot. This kit also has a cool void cloak to go along with it. diff --git a/Resources/Prototypes/Catalog/thief_toolbox_sets.yml b/Resources/Prototypes/Catalog/thief_toolbox_sets.yml index d879fd77eb..fb6873f540 100644 --- a/Resources/Prototypes/Catalog/thief_toolbox_sets.yml +++ b/Resources/Prototypes/Catalog/thief_toolbox_sets.yml @@ -43,7 +43,7 @@ - StorageImplanter - DnaScramblerImplanter - EphedrineChemistryBottle - - OmnizineChemistryBottle + - SoapOmega - Syringe - DrinkVodkaBottleFull @@ -56,6 +56,7 @@ state: telecrystal content: - AgentIDCard + - Emag - SyndicatePersonalAI - ClothingHeadHatSyndieMAA - CigPackSyndicate @@ -87,7 +88,7 @@ state: icon content: - EncryptionKeyStationMaster - - RadioJammer + - CyberPen - SpyCrewMonitor - BriefcaseSyndieLobbyingBundleFilled - ClothingMaskGasVoiceChameleon @@ -105,3 +106,6 @@ - ClothingNeckCloakVoid - FultonBeacon - Fulton + - SmokeGrenade + - SmokeGrenade + - SmokeGrenade diff --git a/Resources/Prototypes/Objectives/objectiveGroups.yml b/Resources/Prototypes/Objectives/objectiveGroups.yml index 95b1fb8593..4681f92c4d 100644 --- a/Resources/Prototypes/Objectives/objectiveGroups.yml +++ b/Resources/Prototypes/Objectives/objectiveGroups.yml @@ -51,7 +51,7 @@ - type: weightedRandom id: ThiefBigObjectiveGroups weights: - ThiefObjectiveGroupStructure: 1 + ThiefObjectiveGroupStructure: 0 #Temporarily disabled until obvious ways to steal structures are added ThiefObjectiveGroupAnimal: 2 - type: weightedRandom diff --git a/Resources/Prototypes/Objectives/thief.yml b/Resources/Prototypes/Objectives/thief.yml index 3201a9957e..c6ebab1dd6 100644 --- a/Resources/Prototypes/Objectives/thief.yml +++ b/Resources/Prototypes/Objectives/thief.yml @@ -123,8 +123,8 @@ job: Scientist - type: StealCondition stealGroup: TechnologyDisk - minCollectionSize: 10 - maxCollectionSize: 20 + minCollectionSize: 5 + maxCollectionSize: 15 verifyMapExistance: false - type: Objective difficulty: 0.8 @@ -136,8 +136,8 @@ components: - type: StealCondition stealGroup: IDCard - minCollectionSize: 10 - maxCollectionSize: 20 + minCollectionSize: 5 + maxCollectionSize: 15 verifyMapExistance: false - type: Objective difficulty: 0.7 @@ -150,7 +150,7 @@ - type: StealCondition stealGroup: EncryptionKey minCollectionSize: 5 - maxCollectionSize: 25 + maxCollectionSize: 15 - type: Objective difficulty: 0.7 @@ -180,7 +180,7 @@ - type: StealCondition stealGroup: LAMP minCollectionSize: 1 - maxCollectionSize: 30 + maxCollectionSize: 10 verifyMapExistance: true - type: Objective difficulty: 0.5 # just for fun, collectings LAMP on Moth