diff --git a/Content.Server/Objectives/Components/PickRandomAntagComponent.cs b/Content.Server/Objectives/Components/PickRandomAntagComponent.cs new file mode 100644 index 0000000000..eb13a4a431 --- /dev/null +++ b/Content.Server/Objectives/Components/PickRandomAntagComponent.cs @@ -0,0 +1,8 @@ +using Content.Server.Objectives.Systems; + +namespace Content.Server.Objectives.Components; + +[RegisterComponent, Access(typeof(KillPersonConditionSystem))] +public sealed partial class PickRandomAntagComponent : Component +{ +} diff --git a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs index 9b7f72e89d..88c4128eb0 100644 --- a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs +++ b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs @@ -8,6 +8,8 @@ using Content.Shared.Mind; using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Systems; using Content.Shared.Objectives.Components; +using Content.Shared.Random.Helpers; +using Content.Shared.Roles; using Robust.Shared.Configuration; using Robust.Shared.Random; @@ -24,6 +26,7 @@ public sealed class KillPersonConditionSystem : EntitySystem [Dependency] private readonly SharedMindSystem _mind = default!; [Dependency] private readonly TargetObjectiveSystem _target = default!; [Dependency] private readonly MobStateSystem _mobState = default!; + [Dependency] private readonly SharedRoleSystem _roleSystem = default!; public override void Initialize() { @@ -34,6 +37,8 @@ public sealed class KillPersonConditionSystem : EntitySystem SubscribeLocalEvent(OnPersonAssigned); SubscribeLocalEvent(OnHeadAssigned); + + SubscribeLocalEvent(OnAntagAssigned); } private void OnGetProgress(EntityUid uid, KillPersonConditionComponent comp, ref ObjectiveGetProgressEvent args) @@ -75,7 +80,7 @@ public sealed class KillPersonConditionSystem : EntitySystem return; } - _target.SetTarget(uid, _random.Pick(allHumans), target); + _target.SetTarget(uid, args.MindId, _random.Pick(allHumans), target); } private void OnHeadAssigned(EntityUid uid, PickRandomHeadComponent comp, ref ObjectiveAssignedEvent args) @@ -109,7 +114,41 @@ public sealed class KillPersonConditionSystem : EntitySystem if (allHeads.Count == 0) allHeads = allHumans; // fallback to non-head target - _target.SetTarget(uid, _random.Pick(allHeads), target); + _target.SetTarget(uid, args.MindId, _random.Pick(allHeads), target); + } + + private void OnAntagAssigned(EntityUid uid, PickRandomAntagComponent comp, ref ObjectiveAssignedEvent args) + { + if (!TryComp(uid, out var target)) + { + args.Cancelled = true; + return; + } + + if (target.Target != null) + return; + + var allHumans = GetAliveTargetsExcept(args.MindId); + if (allHumans.Count == 0) + { + args.Cancelled = true; + return; + } + + var allAntags = new HashSet>(); + foreach (var person in allHumans) + { + if (_roleSystem.MindIsAntagonist(person)) + allAntags.Add(person); + } + + if (allAntags.Count == 0) + { + args.Cancelled = true; + return; + } + + _target.SetTarget(uid, args.MindId, _random.Pick(allAntags), target); } private float GetProgress(EntityUid target, bool requireDead) @@ -148,9 +187,11 @@ public sealed class KillPersonConditionSystem : EntitySystem var allTargets = new HashSet>(); var query = EntityQueryEnumerator(); - while (query.MoveNext(out var uid, out var mobState, out _, out _)) + while (query.MoveNext(out var uid, out var mobState, out var antagTarget, out _)) { - if (!_mind.TryGetMind(uid, out var mind, out var mindComp) || mind == exclude || !_mobState.IsAlive(uid, mobState)) + if (!_mind.TryGetMind(uid, out var mind, out var mindComp) || + mind == exclude || !_mobState.IsAlive(uid, mobState) || + antagTarget.KillerMind != null) continue; allTargets.Add(new Entity(mind, mindComp)); diff --git a/Content.Server/Objectives/Systems/TargetObjectiveSystem.cs b/Content.Server/Objectives/Systems/TargetObjectiveSystem.cs index 82ebd28ca9..e046210b74 100644 --- a/Content.Server/Objectives/Systems/TargetObjectiveSystem.cs +++ b/Content.Server/Objectives/Systems/TargetObjectiveSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Objectives.Components; using Content.Shared.Roles.Jobs; using Robust.Shared.GameObjects; using System.Diagnostics.CodeAnalysis; +using Content.Server._Sunrise.TraitorTarget; namespace Content.Server.Objectives.Systems; @@ -33,11 +34,16 @@ public sealed class TargetObjectiveSystem : EntitySystem /// /// Sets the Target field for the title and other components to use. /// - public void SetTarget(EntityUid uid, EntityUid target, TargetObjectiveComponent? comp = null) + public void SetTarget(EntityUid uid, EntityUid mindId, EntityUid target, TargetObjectiveComponent? comp = null) { if (!Resolve(uid, ref comp)) return; + if (TryComp(target, out var antagTargetCom)) + { + antagTargetCom.KillerMind = mindId; + } + comp.Target = target; } diff --git a/Content.Server/_Sunrise/TraitorTarget/AntagTargetComponent.cs b/Content.Server/_Sunrise/TraitorTarget/AntagTargetComponent.cs index 30757bc559..5b11d09545 100644 --- a/Content.Server/_Sunrise/TraitorTarget/AntagTargetComponent.cs +++ b/Content.Server/_Sunrise/TraitorTarget/AntagTargetComponent.cs @@ -3,5 +3,6 @@ namespace Content.Server._Sunrise.TraitorTarget [RegisterComponent] public sealed partial class AntagTargetComponent : Component { + public EntityUid? KillerMind; } } diff --git a/Resources/Changelog/ChangelogSunrise.yml b/Resources/Changelog/ChangelogSunrise.yml index 0e9a16feb2..4f3491363d 100644 --- a/Resources/Changelog/ChangelogSunrise.yml +++ b/Resources/Changelog/ChangelogSunrise.yml @@ -9407,3 +9407,20 @@ type: Fix id: 654 time: '2025-01-03T09:01:31.287837+00:00' +- author: VigersRay + changes: + - message: "\u0412\u0435\u0440\u043D\u0443\u043B \u0446\u0435\u043B\u0438 \u043D\ + \u0430 \u0445\u0430\u0439\u0434\u0436\u0435\u043A \u0438 \u0441\u043B\u0430\u0432\ + \u043D\u0443\u044E \u0441\u043C\u0435\u0440\u0442\u044C \u0430\u0433\u0435\u043D\ + \u0442\u0430\u043C." + type: Tweak + - message: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0430 \u043D\u043E\u0432\ + \u0430\u044F \u0446\u0435\u043B\u044C \u043D\u0430 \u0443\u0431\u0438\u0439\u0441\ + \u0442\u0432\u043E \u0430\u0433\u0435\u043D\u0442\u0430\u043C." + type: Add + - message: "\u0412\u0435\u0440\u043D\u0443\u043B \u0446\u0435\u043B\u044C \u043D\ + \u0430 \u0434\u0438\u0441\u043A \u044F\u0434\u0435\u0440\u043A\u0438 \u0430\u0433\ + \u0435\u043D\u0442\u0430\u043C." + type: Tweak + id: 655 + time: '2025-01-03T23:11:33.964746+00:00' diff --git a/Resources/Locale/ru-RU/_strings/objectives/conditions/kill-antag.ftl b/Resources/Locale/ru-RU/_strings/objectives/conditions/kill-antag.ftl new file mode 100644 index 0000000000..062b323ab9 --- /dev/null +++ b/Resources/Locale/ru-RU/_strings/objectives/conditions/kill-antag.ftl @@ -0,0 +1 @@ +objective-condition-kill-antag-title = Убить { $targetName }, должность: { CAPITALIZE($job) }. diff --git a/Resources/Prototypes/Objectives/objectiveGroups.yml b/Resources/Prototypes/Objectives/objectiveGroups.yml index 72705cc1c4..3e451a62fd 100644 --- a/Resources/Prototypes/Objectives/objectiveGroups.yml +++ b/Resources/Prototypes/Objectives/objectiveGroups.yml @@ -3,7 +3,7 @@ id: TraitorObjectiveGroups weights: TraitorObjectiveGroupSteal: 1 - TraitorObjectiveGroupKill: 0.5 # Sunrise-Edit: Меньше убийств - меньше гостов. + TraitorObjectiveGroupKill: 1 TraitorObjectiveGroupState: 1 #As in, something about your character. Alive, dead, arrested, gained an ability... TraitorObjectiveGroupSocial: 1 #Involves helping/harming others without killing them or stealing their stuff @@ -14,11 +14,11 @@ CMOHyposprayStealObjective: 1 #CMOCrewMonitorStealObjective: 1 # Sunrise-Edit: Больше не хайриск RDHardsuitStealObjective: 1 - #NukeDiskStealObjective: 1 # Sunrise-Edit: Цель требует убить слишком много людей. + NukeDiskStealObjective: 1 MagbootsStealObjective: 1 CorgiMeatStealObjective: 1 ClipboardStealObjective: 1 - CaptainGunStealObjective: 0.2 # Sunrise-Edit: Чтобы его украсть капитана прийдется убить. + CaptainGunStealObjective: 0.5 CaptainJetpackStealObjective: 0.5 HandTeleporterStealObjective: 0.5 EnergyShotgunStealObjective: 0.5 @@ -32,15 +32,16 @@ - type: weightedRandom id: TraitorObjectiveGroupKill weights: - KillRandomPersonObjective: 1 + KillRandomAntagObjective: 1 + KillRandomPersonObjective: 0.5 KillRandomHeadObjective: 0.25 - type: weightedRandom id: TraitorObjectiveGroupState weights: EscapeShuttleObjective: 1 - #DieObjective: 0.02 # Почему-то трейторы думают что умереть = убить как можно больше. - #HijackShuttleObjective: 0.02 # Нам незачем разрешать рдм в не рдм режиме. + DieObjective: 0.05 + HijackShuttleObjective: 0.03 - type: weightedRandom id: TraitorObjectiveGroupSocial diff --git a/Resources/Prototypes/Objectives/traitor.yml b/Resources/Prototypes/Objectives/traitor.yml index 60fa80ad45..02aeacd0fc 100644 --- a/Resources/Prototypes/Objectives/traitor.yml +++ b/Resources/Prototypes/Objectives/traitor.yml @@ -98,6 +98,20 @@ # if ce flies a shittle to centcom you better find a way onto it requireDead: true +- type: entity + parent: [BaseTraitorObjective, BaseKillObjective] + id: KillRandomAntagObjective + description: + components: + - type: Objective + difficulty: 1.0 + unique: true + - type: TargetObjective + title: objective-condition-kill-antag-title + - type: PickRandomAntag + - type: KillPersonCondition + requireDead: true + # social - type: entity