diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index 2b69505e67..3dde216789 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -1,6 +1,7 @@ using System.Globalization; using System.Linq; using System.Numerics; +using Content.Server._Sunrise.Station; using Content.Server.Administration.Managers; using Content.Server.GameTicking.Events; using Content.Server.Ghost; @@ -23,6 +24,7 @@ using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Utility; +using Content.Server._Sunrise.TraitorTarget; // Sunrise-Edit namespace Content.Server.GameTicking { @@ -254,6 +256,11 @@ namespace Content.Server.GameTicking DebugTools.AssertNotNull(mobMaybe); var mob = mobMaybe!.Value; + // Sunrise-Start + if (HasComp(station)) + EntityManager.AddComponent(mob); + // Sunrise-End + _mind.TransferTo(newMind, mob); if (lateJoin && !silent) diff --git a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs index c1caa819e4..fe66cd6452 100644 --- a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs +++ b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs @@ -1,3 +1,5 @@ +using System.Linq; +using Content.Server._Sunrise.TraitorTarget; using Content.Server.Objectives.Components; using Content.Server.Shuttles.Systems; using Content.Shared.CCVar; @@ -55,6 +57,15 @@ public sealed class KillPersonConditionSystem : EntitySystem // no other humans to kill var allHumans = _mind.GetAliveHumansExcept(args.MindId); + + // Sunrise-Start + foreach (var entityUid in allHumans.ToList()) + { + if (!HasComp(entityUid)) + allHumans.Remove(entityUid); + } + // Sunrise-End + if (allHumans.Count == 0) { args.Cancelled = true; @@ -79,6 +90,13 @@ public sealed class KillPersonConditionSystem : EntitySystem // no other humans to kill var allHumans = _mind.GetAliveHumansExcept(args.MindId); + + foreach (var entityUid in allHumans.ToList()) + { + if (!HasComp(entityUid)) + allHumans.Remove(entityUid); + } + if (allHumans.Count == 0) { args.Cancelled = true; diff --git a/Content.Server/_Sunrise/EvilTwin/EvilTwinSystem.cs b/Content.Server/_Sunrise/EvilTwin/EvilTwinSystem.cs index 97132f8172..c4829b4b4d 100644 --- a/Content.Server/_Sunrise/EvilTwin/EvilTwinSystem.cs +++ b/Content.Server/_Sunrise/EvilTwin/EvilTwinSystem.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; +using Content.Server._Sunrise.TraitorTarget; using Content.Server.DetailExaminable; using Content.Server.Forensics; using Content.Server.GameTicking; @@ -41,8 +42,6 @@ public sealed class EvilTwinSystem : EntitySystem [Dependency] private readonly MetaDataSystem _metaDataSystem = default!; [Dependency] private readonly TargetObjectiveSystem _target = default!; [Dependency] private readonly SharedObjectivesSystem _objectives = default!; - [Dependency] private readonly LoadoutSystem _loadoutSystem = default!; - [ValidatePrototypeId] private const string EvilTwinRole = "EvilTwin"; @@ -59,7 +58,7 @@ public sealed class EvilTwinSystem : EntitySystem SubscribeLocalEvent(OnRoundEnd); } - private void OnPlayerAttached(EntityUid uid, _Sunrise.EvilTwin.EvilTwinSpawnerComponent component, PlayerAttachedEvent args) + private void OnPlayerAttached(EntityUid uid, EvilTwinSpawnerComponent component, PlayerAttachedEvent args) { if (TryGetEligibleHumanoid(out var targetUid)) { @@ -88,8 +87,8 @@ public sealed class EvilTwinSystem : EntitySystem _roleSystem.MindAddRole(mindId, role, mind); _mindSystem.TryAddObjective(mindId, mind, EscapeObjective); _mindSystem.TryAddObjective(mindId, mind, KillObjective); - if (_mindSystem.TryGetObjectiveComp(uid, out var obj)) // Sunrise-edit - _target.SetTarget(uid, evilTwin.TargetMindId, obj); // Sunrise-edit + if (_mindSystem.TryGetObjectiveComp(uid, out var obj)) + _target.SetTarget(uid, evilTwin.TargetMindId, obj); } private void OnRoundEnd(RoundEndTextAppendEvent ev) @@ -176,9 +175,9 @@ public sealed class EvilTwinSystem : EntitySystem /// false if not found private bool TryGetEligibleHumanoid([NotNullWhen(true)] out EntityUid? uid) { - var targets = EntityQuery().ToList(); + var targets = EntityQuery().ToList(); _random.Shuffle(targets); - foreach (var (actor, _) in targets) + foreach (var (actor, _, _) in targets) { if (!_mindSystem.TryGetMind(actor.PlayerSession, out var mindId, out var mind) || mind.OwnedEntity == null) continue; @@ -186,8 +185,6 @@ public sealed class EvilTwinSystem : EntitySystem if (!_jobSystem.MindTryGetJob(mindId, out _, out _)) continue; - // There was check for nukeops or evil twin, but ist it will be fun? - uid = mind.OwnedEntity; return true; } @@ -229,7 +226,6 @@ public sealed class EvilTwinSystem : EntitySystem { pref.Loadouts.TryGetValue(jobLoadout, out var loadout); - // Set to default if not present if (loadout == null) { loadout = new RoleLoadout(jobLoadout); diff --git a/Content.Server/_Sunrise/Station/StationAntagsTargetsComponent.cs b/Content.Server/_Sunrise/Station/StationAntagsTargetsComponent.cs new file mode 100644 index 0000000000..2384b34296 --- /dev/null +++ b/Content.Server/_Sunrise/Station/StationAntagsTargetsComponent.cs @@ -0,0 +1,7 @@ +namespace Content.Server._Sunrise.Station; + +[RegisterComponent] +public sealed partial class StationAntagsTargetsComponent : Component +{ + +} diff --git a/Content.Server/_Sunrise/TraitorTarget/AntagTargetComponent.cs b/Content.Server/_Sunrise/TraitorTarget/AntagTargetComponent.cs new file mode 100644 index 0000000000..30757bc559 --- /dev/null +++ b/Content.Server/_Sunrise/TraitorTarget/AntagTargetComponent.cs @@ -0,0 +1,7 @@ +namespace Content.Server._Sunrise.TraitorTarget +{ + [RegisterComponent] + public sealed partial class AntagTargetComponent : Component + { + } +} diff --git a/Resources/Changelog/ChangelogSunrise.yml b/Resources/Changelog/ChangelogSunrise.yml index 144c03ea3a..398410d320 100644 --- a/Resources/Changelog/ChangelogSunrise.yml +++ b/Resources/Changelog/ChangelogSunrise.yml @@ -1578,3 +1578,13 @@ type: Tweak id: 119 time: '2024-07-12T02:17:26.755638+00:00' +- author: VigersRay + changes: + - message: "\u0426\u0435\u043B\u044C\u044E \u0434\u043B\u044F \u0443\u0431\u0438\ + \u0439\u0441\u0442\u0432\u0430 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\ + \u044C \u0442\u043E\u043B\u044C\u043A\u043E \u044D\u043A\u0438\u043F\u0430\u0436\ + \ \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0439 \u0441\u0442\u0430\u043D\u0446\ + \u0438\u0438." + type: Tweak + id: 120 + time: '2024-07-12T03:12:49.272328+00:00' diff --git a/Resources/Prototypes/Entities/Stations/nanotrasen.yml b/Resources/Prototypes/Entities/Stations/nanotrasen.yml index b2bb5e1e0e..8d1ec6549c 100644 --- a/Resources/Prototypes/Entities/Stations/nanotrasen.yml +++ b/Resources/Prototypes/Entities/Stations/nanotrasen.yml @@ -31,6 +31,7 @@ - BaseStationPlanetPrison - BaseStationGoal - BaseStationGammaArmory + - BaseStationAntagsTargets # Sunrise-End noSpawn: true components: diff --git a/Resources/Prototypes/_Sunrise/Entities/Stations/base.yml b/Resources/Prototypes/_Sunrise/Entities/Stations/base.yml index 2285da2bfe..9be8b97568 100644 --- a/Resources/Prototypes/_Sunrise/Entities/Stations/base.yml +++ b/Resources/Prototypes/_Sunrise/Entities/Stations/base.yml @@ -104,3 +104,9 @@ components: - type: AlertLevel alertLevelPrototype: stationPrisonAlerts + +- type: entity + id: BaseStationAntagsTargets + abstract: true + components: + - type: StationAntagsTargetsComponent