New Thief minor antagonist (#21520)
* start working * add right-click thief antagins some architecture restruct * add meh thief greeting audio * add thief subgamemode to Traitors gamemode * add late join thief (not tested yet) add briefing * add pacifism * add Steal tasks to thief * fix crash thief+traitor on person * add new condition: collection steal * add tracking of succes collection objective * add stamp collection target remove some boring steal target add check pulling entity to collection target * finalize first 2 group objective * start merging stealing objective systems * merging * finish merging. Now traitor steal objective work better * we don't check the items of pullable sentient entity * clear naming, enable thief signle item objective start * objective pack add * finish with steal item objectives * convert string to ProtoId<> * some clean up * add thieves to revolution game mode * Update Resources/Locale/en-US/game-ticking/game-presets/preset-thief.ftl Co-authored-by: Flareguy <78941145+Flareguy@users.noreply.github.com> * Update Resources/Locale/en-US/game-ticking/game-presets/preset-thief.ftl Co-authored-by: Flareguy <78941145+Flareguy@users.noreply.github.com> * update pacifism: fix crashing, monkey-thief without pacified * adaptive animal briefing, cleaning locales * add structure steal objectives * remove RCD target * add thiefs to manifest, but bug with traitor duplications * add escape objective * add chat briefing * setup animal objective group system * add animal steal objectives * add animal objectives notroleconditions * add morty * now thief mode has a chance of not launching Now there are a random number of thieves per round from 1 to 3 * 6 hours of trying to fix duplicate tasks. Failure * added thief pinpointer (buggy) * start thief backpack UI work * revert pinpointer for scope reason * UI continue work * add thief starter kits content * remove ERP kit :trollface: * finally! giving starting items to thief. Now it playable, but still need more work * clean up * fix * fox * add merged items into thief new Starting Kit (buggy) * fix YES antag menu * objection tweaks * remove hearts objective, working on spawning things from toolbox * smug * fixes * add race specifier objective condition LAMPS * meh * fix fix fix * the alive * Adding stamps * Update backpack.ftl * Revert1 * Revert ftl * add voice mask to communicator kit * Update Resources/Locale/en-US/administration/antag.ftl Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> * Update Resources/Locale/en-US/game-ticking/game-presets/preset-thief.ftl Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> * Update Resources/Locale/en-US/thief/backpack.ftl Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> * Update Resources/Locale/en-US/objectives/conditions/steal.ftl Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> * Update Resources/Locale/en-US/thief/backpack.ftl Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> * Update Resources/Locale/en-US/thief/backpack.ftl Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> * Update Resources/Locale/en-US/thief/backpack.ftl Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> * Update Resources/Locale/en-US/thief/backpack.ftl Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> * Update Resources/Locale/en-US/prototypes/roles/antags.ftl Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> * Update Resources/Locale/en-US/thief/backpack.ftl Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> * update * fix * more reusable function, add documentation * fix doc * faint fixes --------- Co-authored-by: Flareguy <78941145+Flareguy@users.noreply.github.com> Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Antag;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Server.Mind;
|
||||
@@ -30,6 +31,7 @@ namespace Content.Server.GameTicking.Rules;
|
||||
|
||||
public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
|
||||
{
|
||||
[Dependency] private readonly AntagSelectionSystem _antagSelection = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
@@ -117,8 +119,8 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
|
||||
}
|
||||
|
||||
var numTraitors = MathHelper.Clamp(component.StartCandidates.Count / PlayersPerTraitor, 1, MaxTraitors);
|
||||
var traitorPool = FindPotentialTraitors(component.StartCandidates, component);
|
||||
var selectedTraitors = PickTraitors(numTraitors, traitorPool);
|
||||
var traitorPool = _antagSelection.FindPotentialAntags(component.StartCandidates, component.TraitorPrototypeId);
|
||||
var selectedTraitors = _antagSelection.PickAntag(numTraitors, traitorPool);
|
||||
|
||||
foreach (var traitor in selectedTraitors)
|
||||
{
|
||||
@@ -153,61 +155,6 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
|
||||
}
|
||||
}
|
||||
|
||||
private List<ICommonSession> FindPotentialTraitors(in Dictionary<ICommonSession, HumanoidCharacterProfile> candidates, TraitorRuleComponent component)
|
||||
{
|
||||
var list = new List<ICommonSession>();
|
||||
var pendingQuery = GetEntityQuery<PendingClockInComponent>();
|
||||
|
||||
foreach (var player in candidates.Keys)
|
||||
{
|
||||
// Role prevents antag.
|
||||
if (!_jobs.CanBeAntag(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Latejoin
|
||||
if (player.AttachedEntity != null && pendingQuery.HasComponent(player.AttachedEntity.Value))
|
||||
continue;
|
||||
|
||||
list.Add(player);
|
||||
}
|
||||
|
||||
var prefList = new List<ICommonSession>();
|
||||
|
||||
foreach (var player in list)
|
||||
{
|
||||
var profile = candidates[player];
|
||||
if (profile.AntagPreferences.Contains(component.TraitorPrototypeId))
|
||||
{
|
||||
prefList.Add(player);
|
||||
}
|
||||
}
|
||||
if (prefList.Count == 0)
|
||||
{
|
||||
Log.Info("Insufficient preferred traitors, picking at random.");
|
||||
prefList = list;
|
||||
}
|
||||
return prefList;
|
||||
}
|
||||
|
||||
private List<ICommonSession> PickTraitors(int traitorCount, List<ICommonSession> prefList)
|
||||
{
|
||||
var results = new List<ICommonSession>(traitorCount);
|
||||
if (prefList.Count == 0)
|
||||
{
|
||||
Log.Info("Insufficient ready players to fill up with traitors, stopping the selection.");
|
||||
return results;
|
||||
}
|
||||
|
||||
for (var i = 0; i < traitorCount; i++)
|
||||
{
|
||||
results.Add(_random.PickAndTake(prefList));
|
||||
Log.Info("Selected a preferred traitor.");
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public bool MakeTraitor(ICommonSession traitor, bool giveUplink = true, bool giveObjectives = true)
|
||||
{
|
||||
var traitorRule = EntityQuery<TraitorRuleComponent>().FirstOrDefault();
|
||||
|
||||
Reference in New Issue
Block a user