Skip to content
Merged

Dev #271

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2ff59f1
Add support for antag-before-job selection (#35789)
SlamBamActionman Mar 12, 2025
45e5fbf
forensics cleanup (#35795)
slarticodefast Mar 12, 2025
d8ac152
polymorph popup fixes (#35796)
slarticodefast Mar 12, 2025
ccc8837
fix more syndicate names (#35788)
slarticodefast Mar 12, 2025
051950b
Merge pull request #266 from space-wizards/master
pull[bot] Mar 12, 2025
0d16bd5
New Feature: Warden job rolls before security officer/cadet/detective…
Winkarst-cpu Mar 12, 2025
28ff4ed
Automatic changelog update
PJBot Mar 12, 2025
b7759cc
Fix anomaly doublelogging (#34297)
ninruB Mar 12, 2025
9005183
Add wallmount N2 closets, Revived (#34042)
IamVelcroboy Mar 12, 2025
8f81e55
Cryo and grinder cleanup (#34842)
insoPL Mar 12, 2025
212bf99
Add Gold and Coal Rock Anomalies (#34809)
Firewars763 Mar 12, 2025
e4b2680
Automatic changelog update
PJBot Mar 12, 2025
b3482fd
Tools/Devices: In-hand Sprites (#33689)
onesch Mar 12, 2025
f9a4846
Automatic changelog update
PJBot Mar 12, 2025
63ecf42
IconSmooth additional smoothing keys (#35790)
TheShuEd Mar 12, 2025
e1762d9
Locks nitrous oxide canisters (#35785)
K-Dynamic Mar 13, 2025
3f8be60
Automatic changelog update
PJBot Mar 13, 2025
48a4aa3
Cleanup Objective files, add PickSpecificPersonComponent (#35802)
slarticodefast Mar 13, 2025
b2c43c0
Merge pull request #267 from space-wizards/master
pull[bot] Mar 13, 2025
96501f4
Adds popup when firing gun while gun has no ammo (#34816)
Plykiya Mar 13, 2025
0b1e25b
Automatic changelog update
PJBot Mar 13, 2025
90dc674
Add the ability to pet the mail teleporter (#35819)
CroilBird Mar 13, 2025
66a0201
Automatic changelog update
PJBot Mar 13, 2025
d4b7a6d
Whitehole/Singularity grenade price adjustments + whitehole grenade f…
ScarKy0 Mar 13, 2025
4a4d3d6
Automatic changelog update
PJBot Mar 13, 2025
597d0eb
Merge pull request #268 from space-wizards/master
pull[bot] Mar 13, 2025
1b2d3d6
Update Lobby Music Attribtions (#35817)
Lusatia Mar 13, 2025
bce9b4b
Paradox Clone (#35794)
slarticodefast Mar 13, 2025
33edf96
Automatic changelog update
PJBot Mar 13, 2025
1945c7d
Improvements to antag-before-job selection system (#35822)
SlamBamActionman Mar 13, 2025
9071256
Merge pull request #269 from space-wizards/master
pull[bot] Mar 13, 2025
4f009fc
Merge pull request #270 from MW-GC/upstream
MWG-Logan Mar 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Content.Client/IconSmoothing/IconSmoothComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ public sealed partial class IconSmoothComponent : Component
[ViewVariables(VVAccess.ReadWrite), DataField("key")]
public string? SmoothKey { get; private set; }

/// <summary>
/// Additional keys to smooth with.
/// </summary>
[DataField]
public List<string> AdditionalKeys = new();

/// <summary>
/// Prepended to the RSI state.
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/IconSmoothing/IconSmoothSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ private bool MatchingEntity(IconSmoothComponent smooth, AnchoredEntitiesEnumerat
while (candidates.MoveNext(out var entity))
{
if (smoothQuery.TryGetComponent(entity, out var other) &&
other.SmoothKey == smooth.SmoothKey &&
other.SmoothKey != null &&
(other.SmoothKey == smooth.SmoothKey || smooth.AdditionalKeys.Contains(other.SmoothKey)) &&
other.Enabled)
{
return true;
Expand Down
74 changes: 67 additions & 7 deletions Content.Server/Antag/AntagSelectionSystem.API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
using Content.Server.Antag.Components;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Objectives;
using Content.Shared.Antag;
using Content.Shared.Chat;
using Content.Shared.GameTicking.Components;
using Content.Shared.Mind;
using Content.Shared.Preferences;
using JetBrains.Annotations;
Expand All @@ -25,7 +27,7 @@ public bool TryGetNextAvailableDefinition(Entity<AntagSelectionComponent> ent,
definition = null;

var totalTargetCount = GetTargetAntagCount(ent, players);
var mindCount = ent.Comp.SelectedMinds.Count;
var mindCount = ent.Comp.AssignedMinds.Count;
if (mindCount >= totalTargetCount)
return false;

Expand Down Expand Up @@ -95,7 +97,7 @@ public int GetTargetAntagCount(Entity<AntagSelectionComponent> ent, int? playerC
var countOffset = 0;
foreach (var otherDef in ent.Comp.Definitions)
{
countOffset += Math.Clamp((poolSize - countOffset) / otherDef.PlayerRatio, otherDef.Min, otherDef.Max) * otherDef.PlayerRatio;
countOffset += Math.Clamp((poolSize - countOffset) / otherDef.PlayerRatio, otherDef.Min, otherDef.Max) * otherDef.PlayerRatio; // Note: Is the PlayerRatio necessary here? Seems like it can cause issues for defs with varied PlayerRatio.
}
// make sure we don't double-count the current selection
countOffset -= Math.Clamp(poolSize / def.PlayerRatio, def.Min, def.Max) * def.PlayerRatio;
Expand All @@ -115,7 +117,7 @@ public int GetTargetAntagCount(Entity<AntagSelectionComponent> ent, int? playerC
return new List<(EntityUid, SessionData, string)>();

var output = new List<(EntityUid, SessionData, string)>();
foreach (var (mind, name) in ent.Comp.SelectedMinds)
foreach (var (mind, name) in ent.Comp.AssignedMinds)
{
if (!TryComp<MindComponent>(mind, out var mindComp) || mindComp.OriginalOwnerUserId == null)
continue;
Expand All @@ -137,7 +139,7 @@ public List<Entity<MindComponent>> GetAntagMinds(Entity<AntagSelectionComponent?
return new();

var output = new List<Entity<MindComponent>>();
foreach (var (mind, _) in ent.Comp.SelectedMinds)
foreach (var (mind, _) in ent.Comp.AssignedMinds)
{
if (!TryComp<MindComponent>(mind, out var mindComp) || mindComp.OriginalOwnerUserId == null)
continue;
Expand All @@ -155,7 +157,7 @@ public List<EntityUid> GetAntagMindEntityUids(Entity<AntagSelectionComponent?> e
if (!Resolve(ent, ref ent.Comp, false))
return new();

return ent.Comp.SelectedMinds.Select(p => p.Item1).ToList();
return ent.Comp.AssignedMinds.Select(p => p.Item1).ToList();
}

/// <summary>
Expand Down Expand Up @@ -247,7 +249,7 @@ public bool AllAntagsAlive(Entity<AntagSelectionComponent?> ent)
if (!Resolve(ent, ref ent.Comp, false))
return false;

return GetAliveAntagCount(ent) == ent.Comp.SelectedMinds.Count;
return GetAliveAntagCount(ent) == ent.Comp.AssignedMinds.Count;
}

/// <summary>
Expand Down Expand Up @@ -352,8 +354,66 @@ public Entity<AntagSelectionComponent> ForceGetGameRuleEnt<T>(string id) where T
var ruleEnt = GameTicker.AddGameRule(id);
RemComp<LoadMapRuleComponent>(ruleEnt);
var antag = Comp<AntagSelectionComponent>(ruleEnt);
antag.SelectionsComplete = true; // don't do normal selection.
antag.AssignmentComplete = true; // don't do normal selection.
GameTicker.StartGameRule(ruleEnt);
return (ruleEnt, antag);
}

/// <summary>
/// Get all sessions that have been preselected for antag.
/// </summary>
/// <param name="except">A specific definition to be excluded from the check.</param>
public HashSet<ICommonSession> GetPreSelectedAntagSessions(AntagSelectionDefinition? except = null)
{
var result = new HashSet<ICommonSession>();
var query = QueryAllRules();
while (query.MoveNext(out var uid, out var comp, out _))
{
if (HasComp<EndedGameRuleComponent>(uid))
continue;

foreach (var def in comp.Definitions)
{
if (def.Equals(except))
continue;

if (comp.PreSelectedSessions.TryGetValue(def, out var set))
result.UnionWith(set);
}
}

return result;
}

/// <summary>
/// Get all sessions that have been preselected for antag and are exclusive, i.e. should not be paired with other antags.
/// </summary>
/// <param name="except">A specific definition to be excluded from the check.</param>
// Note: This is a bit iffy since technically this exclusive definition is defined via the MultiAntagSetting, while there's a separately tracked antagExclusive variable in the mindrole.
// We can't query that however since there's no guarantee the mindrole has been given out yet when checking pre-selected antags.
// I don't think there's any instance where they differ, but it's something to be aware of for a potential future refactor.
public HashSet<ICommonSession> GetPreSelectedExclusiveAntagSessions(AntagSelectionDefinition? except = null)
{
var result = new HashSet<ICommonSession>();
var query = QueryAllRules();
while (query.MoveNext(out var uid, out var comp, out _))
{
if (HasComp<EndedGameRuleComponent>(uid))
continue;

foreach (var def in comp.Definitions)
{
if (def.Equals(except))
continue;

if (def.MultiAntagSetting == AntagAcceptability.None && comp.PreSelectedSessions.TryGetValue(def, out var set))
{
result.UnionWith(set);
break;
}
}
}

return result;
}
}
Loading
Loading