From cd16bf7088c6edfe6e38208184280704e0d462aa Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:42:11 -0500 Subject: [PATCH 01/11] bogos binted --- .../EE/GameTicking/Events/RoundEndedEvent.cs | 13 ++++++ .../GameTicking/GameTicker.RoundFlow.cs | 1 + .../Systems/KillPersonConditionSystem.cs | 46 +++++++++++++------ .../objectives/conditions/kill-person.ftl | 2 +- Resources/Prototypes/Objectives/traitor.yml | 2 +- 5 files changed, 48 insertions(+), 16 deletions(-) create mode 100644 Content.Server/EE/GameTicking/Events/RoundEndedEvent.cs diff --git a/Content.Server/EE/GameTicking/Events/RoundEndedEvent.cs b/Content.Server/EE/GameTicking/Events/RoundEndedEvent.cs new file mode 100644 index 00000000000..36bd1f47a1b --- /dev/null +++ b/Content.Server/EE/GameTicking/Events/RoundEndedEvent.cs @@ -0,0 +1,13 @@ +namespace Content.Server.GameTicking; + +public sealed class RoundEndedEvent : EntityEventArgs +{ + public int RoundId { get; } + public TimeSpan RoundDuration { get; } + + public RoundEndedEvent(int roundId, TimeSpan roundDuration) + { + RoundId = roundId; + RoundDuration = roundDuration; + } +} diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index a7dd5d6ab62..8556448c70c 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -451,6 +451,7 @@ public void ShowRoundEndScoreboard(string text = "") _replayRoundPlayerInfo = listOfPlayerInfoFinal; _replayRoundText = roundEndText; + RaiseLocalEvent(new RoundEndedEvent(RoundId, roundDuration)); //DeltaV - EE change ported } private async void SendRoundEndDiscordMessage() diff --git a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs index d61310908c3..bd6c9e54807 100644 --- a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs +++ b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs @@ -1,5 +1,7 @@ using System.Linq; using Content.Server.Objectives.Components; +using Content.Server.GameTicking; //DeltaV port from EE +using Content.Server.Station.Systems; //DeltaV port from EE using Content.Server.Revolutionary.Components; using Content.Server.Shuttles.Systems; using Content.Shared.CCVar; @@ -21,6 +23,7 @@ public sealed class KillPersonConditionSystem : EntitySystem [Dependency] private readonly SharedMindSystem _mind = default!; [Dependency] private readonly TargetObjectiveSystem _target = default!; + private List _wasKilled = new(); public override void Initialize() { base.Initialize(); @@ -28,6 +31,7 @@ public override void Initialize() SubscribeLocalEvent(OnGetProgress); SubscribeLocalEvent(OnPersonAssigned); SubscribeLocalEvent(OnHeadAssigned); + SubscribeLocalEvent(OnRoundEnd); //DeltaV Port from EE } private void OnGetProgress(EntityUid uid, KillPersonConditionComponent comp, ref ObjectiveGetProgressEvent args) @@ -91,29 +95,43 @@ private float GetProgress(EntityUid target, bool requireDead) { // deleted or gibbed or something, counts as dead if (!TryComp(target, out var mind) || mind.OwnedEntity == null) + { //DeltaV Port from EE + if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); //DeltaV Port from EE return 1f; + } // dead is success if (_mind.IsCharacterDeadIc(mind)) + { + if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); //DeltaV Port from EE + return 1f; + } + + // if the target was killed once and it isn't a head objective + if (_wasKilled.Contains(target)) return 1f; + return 0f; + } // if the target has to be dead dead then don't check evac stuff - if (requireDead) - return 0f; +// if (requireDead) +// return 0f; // if evac is disabled then they really do have to be dead - if (!_config.GetCVar(CCVars.EmergencyShuttleEnabled)) - return 0f; +// if (!_config.GetCVar(CCVars.EmergencyShuttleEnabled)) +// return 0f; // target is escaping so you fail - if (_emergencyShuttle.IsTargetEscaping(mind.OwnedEntity.Value)) - return 0f; - - // evac has left without the target, greentext since the target is afk in space with a full oxygen tank and coordinates off. - if (_emergencyShuttle.ShuttlesLeft) - return 1f; - - // if evac is still here and target hasn't boarded, show 50% to give you an indicator that you are doing good - return _emergencyShuttle.EmergencyShuttleArrived ? 0.5f : 0f; - } +// if (_emergencyShuttle.IsTargetEscaping(mind.OwnedEntity.Value)) +// return 0f; +// +// // evac has left without the target, greentext since the target is afk in space with a full oxygen tank and coordinates off. +// if (_emergencyShuttle.ShuttlesLeft) +// return 1f; +// +// // if evac is still here and target hasn't boarded, show 50% to give you an indicator that you are doing good +// return _emergencyShuttle.EmergencyShuttleArrived ? 0.5f : 0f; + // Clear the wasKilled list on round end + private void OnRoundEnd(RoundEndedEvent ev) //DeltaV port from EE + => _wasKilled.Clear(); //DeltaV port from EE } diff --git a/Resources/Locale/en-US/objectives/conditions/kill-person.ftl b/Resources/Locale/en-US/objectives/conditions/kill-person.ftl index c48e2122ff4..3b1c72c9543 100644 --- a/Resources/Locale/en-US/objectives/conditions/kill-person.ftl +++ b/Resources/Locale/en-US/objectives/conditions/kill-person.ftl @@ -1 +1 @@ -objective-condition-kill-person-title = Kill or maroon {$targetName}, {CAPITALIZE($job)} +objective-condition-kill-person-title = Teach {$targetName}, {CAPITALIZE($job)} a lesson diff --git a/Resources/Prototypes/Objectives/traitor.yml b/Resources/Prototypes/Objectives/traitor.yml index 3acfb04d244..3b6b76875ce 100644 --- a/Resources/Prototypes/Objectives/traitor.yml +++ b/Resources/Prototypes/Objectives/traitor.yml @@ -88,7 +88,7 @@ - type: entity parent: [BaseTraitorObjective, BaseKillObjective] id: KillRandomPersonObjective - description: Do it however you like, just make sure they don't make it to centcomm. + description: Kill them, and show everyone we mean business. They only need to die once. #DeltaV change to reflect that people only gotta die once. components: - type: Objective difficulty: 1.75 From a85a7a684b01d7b1b0e9a9410d8f13a1d0696b5c Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:44:14 -0500 Subject: [PATCH 02/11] bogos binted --- .../Objectives/Systems/KillPersonConditionSystem.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs index bd6c9e54807..d9ff41e1765 100644 --- a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs +++ b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs @@ -90,20 +90,20 @@ private void AssignRandomTarget(EntityUid uid, ObjectiveAssignedEvent args, Pred _target.SetTarget(uid, _random.Pick(selectedHumans), target); } - + // DeltaV - start making people only die once from EE private float GetProgress(EntityUid target, bool requireDead) { // deleted or gibbed or something, counts as dead if (!TryComp(target, out var mind) || mind.OwnedEntity == null) - { //DeltaV Port from EE - if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); //DeltaV Port from EE + { + if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); return 1f; } // dead is success if (_mind.IsCharacterDeadIc(mind)) { - if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); //DeltaV Port from EE + if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); return 1f; } @@ -132,6 +132,7 @@ private float GetProgress(EntityUid target, bool requireDead) // // if evac is still here and target hasn't boarded, show 50% to give you an indicator that you are doing good // return _emergencyShuttle.EmergencyShuttleArrived ? 0.5f : 0f; // Clear the wasKilled list on round end - private void OnRoundEnd(RoundEndedEvent ev) //DeltaV port from EE - => _wasKilled.Clear(); //DeltaV port from EE + private void OnRoundEnd(RoundEndedEvent ev) + => _wasKilled.Clear(); + // DeltaV - end making people only die once from EE } From e518dbe84ad0739d1ffe7fb9b7799daa1819053f Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:03:49 -0500 Subject: [PATCH 03/11] bogos binted --- .../EE/GameTicking/Events/RoundEndedEvent.cs | 13 ------------- Content.Server/GameTicking/GameTicker.RoundFlow.cs | 1 - .../Objectives/Systems/KillPersonConditionSystem.cs | 13 +++++-------- 3 files changed, 5 insertions(+), 22 deletions(-) delete mode 100644 Content.Server/EE/GameTicking/Events/RoundEndedEvent.cs diff --git a/Content.Server/EE/GameTicking/Events/RoundEndedEvent.cs b/Content.Server/EE/GameTicking/Events/RoundEndedEvent.cs deleted file mode 100644 index 36bd1f47a1b..00000000000 --- a/Content.Server/EE/GameTicking/Events/RoundEndedEvent.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Content.Server.GameTicking; - -public sealed class RoundEndedEvent : EntityEventArgs -{ - public int RoundId { get; } - public TimeSpan RoundDuration { get; } - - public RoundEndedEvent(int roundId, TimeSpan roundDuration) - { - RoundId = roundId; - RoundDuration = roundDuration; - } -} diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index 8556448c70c..a7dd5d6ab62 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -451,7 +451,6 @@ public void ShowRoundEndScoreboard(string text = "") _replayRoundPlayerInfo = listOfPlayerInfoFinal; _replayRoundText = roundEndText; - RaiseLocalEvent(new RoundEndedEvent(RoundId, roundDuration)); //DeltaV - EE change ported } private async void SendRoundEndDiscordMessage() diff --git a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs index d9ff41e1765..42e4a6db715 100644 --- a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs +++ b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs @@ -23,7 +23,8 @@ public sealed class KillPersonConditionSystem : EntitySystem [Dependency] private readonly SharedMindSystem _mind = default!; [Dependency] private readonly TargetObjectiveSystem _target = default!; - private List _wasKilled = new(); + private List _wasKilled = new(); //DeltaV Port from EE + public override void Initialize() { base.Initialize(); @@ -31,7 +32,7 @@ public override void Initialize() SubscribeLocalEvent(OnGetProgress); SubscribeLocalEvent(OnPersonAssigned); SubscribeLocalEvent(OnHeadAssigned); - SubscribeLocalEvent(OnRoundEnd); //DeltaV Port from EE + SubscribeLocalEvent(OnRoundEnd); //DeltaV Kill objective } private void OnGetProgress(EntityUid uid, KillPersonConditionComponent comp, ref ObjectiveGetProgressEvent args) @@ -106,11 +107,7 @@ private float GetProgress(EntityUid target, bool requireDead) if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); return 1f; } - - // if the target was killed once and it isn't a head objective - if (_wasKilled.Contains(target)) - return 1f; - + return 0f; } // if the target has to be dead dead then don't check evac stuff @@ -132,7 +129,7 @@ private float GetProgress(EntityUid target, bool requireDead) // // if evac is still here and target hasn't boarded, show 50% to give you an indicator that you are doing good // return _emergencyShuttle.EmergencyShuttleArrived ? 0.5f : 0f; // Clear the wasKilled list on round end - private void OnRoundEnd(RoundEndedEvent ev) + private void OnRoundEnd(RoundRestartCleanupEvent ev) => _wasKilled.Clear(); // DeltaV - end making people only die once from EE } From 8e19c8777a4d825da545ddeed98edf1b9de49cca Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:32:24 -0500 Subject: [PATCH 04/11] bogos binted --- .../TeachLessonConditionComponent.cs | 17 +++ .../TeachPickRandomHeadComponent.cs | 12 ++ .../TeachPickRandomPersonComponent.cs | 11 ++ .../Systems/TeachLessonConditionSystem.cs | 133 ++++++++++++++++++ .../Systems/KillPersonConditionSystem.cs | 48 +++---- .../objectives/conditions/teach-head.ftl | 1 + .../objectives/conditions/teach-person.ftl | 1 + .../objectives/conditions/kill-person.ftl | 2 +- .../Prototypes/DeltaV/Objectives/traitor.yml | 33 +++++ .../Prototypes/Objectives/objectiveGroups.yml | 6 +- 10 files changed, 229 insertions(+), 35 deletions(-) create mode 100644 Content.Server/DeltaV/Objectives/Components/TeachLessonConditionComponent.cs create mode 100644 Content.Server/DeltaV/Objectives/Components/TeachPickRandomHeadComponent.cs create mode 100644 Content.Server/DeltaV/Objectives/Components/TeachPickRandomPersonComponent.cs create mode 100644 Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs create mode 100644 Resources/Locale/en-US/deltav/objectives/conditions/teach-head.ftl create mode 100644 Resources/Locale/en-US/deltav/objectives/conditions/teach-person.ftl diff --git a/Content.Server/DeltaV/Objectives/Components/TeachLessonConditionComponent.cs b/Content.Server/DeltaV/Objectives/Components/TeachLessonConditionComponent.cs new file mode 100644 index 00000000000..2f36759874b --- /dev/null +++ b/Content.Server/DeltaV/Objectives/Components/TeachLessonConditionComponent.cs @@ -0,0 +1,17 @@ +using Content.Server.Objectives.Systems; + +namespace Content.Server.Objectives.Components; + +/// +/// Requires that a target dies or, if is false, is not on the emergency shuttle. +/// Depends on to function. +/// +[RegisterComponent, Access(typeof(TeachLessonConditionSystem))] +public sealed partial class TeachLessonConditionComponent : Component +{ + /// + /// Whether the target must be truly dead, ignores missing evac. + /// + [DataField, ViewVariables(VVAccess.ReadWrite)] + public bool RequireDead = false; +} diff --git a/Content.Server/DeltaV/Objectives/Components/TeachPickRandomHeadComponent.cs b/Content.Server/DeltaV/Objectives/Components/TeachPickRandomHeadComponent.cs new file mode 100644 index 00000000000..1ce0aaa385b --- /dev/null +++ b/Content.Server/DeltaV/Objectives/Components/TeachPickRandomHeadComponent.cs @@ -0,0 +1,12 @@ +using Content.Server.Objectives.Systems; + +namespace Content.Server.Objectives.Components; + +/// +/// Sets the target for to a random head. +/// If there are no heads it will fallback to any person. +/// +[RegisterComponent, Access(typeof(TeachLessonConditionSystem))] +public sealed partial class TeachPickRandomHeadComponent : Component +{ +} diff --git a/Content.Server/DeltaV/Objectives/Components/TeachPickRandomPersonComponent.cs b/Content.Server/DeltaV/Objectives/Components/TeachPickRandomPersonComponent.cs new file mode 100644 index 00000000000..06ee763ae62 --- /dev/null +++ b/Content.Server/DeltaV/Objectives/Components/TeachPickRandomPersonComponent.cs @@ -0,0 +1,11 @@ +using Content.Server.Objectives.Systems; + +namespace Content.Server.Objectives.Components; + +/// +/// Sets the target for to a random person. +/// +[RegisterComponent, Access(typeof(TeachLessonConditionSystem))] +public sealed partial class TeachPickRandomPersonComponent : Component +{ +} diff --git a/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs b/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs new file mode 100644 index 00000000000..3664b7d2e49 --- /dev/null +++ b/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs @@ -0,0 +1,133 @@ +using System.Linq; +using Content.Server.Objectives.Components; +using Content.Shared.GameTicking; //DeltaV Teach lesson +using Content.Server.Revolutionary.Components; +using Content.Server.Shuttles.Systems; +using Content.Shared.Mind; +using Content.Shared.Objectives.Components; +using Robust.Shared.Configuration; +using Robust.Shared.Random; + +namespace Content.Server.Objectives.Systems; + +/// +/// Handles kill person condition logic and picking random kill targets. +/// +public sealed class TeachLessonConditionSystem : EntitySystem +{ + [Dependency] private readonly EmergencyShuttleSystem _emergencyShuttle = default!; + [Dependency] private readonly IConfigurationManager _config = default!; + [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly SharedMindSystem _mind = default!; + [Dependency] private readonly TargetObjectiveSystem _target = default!; + + private List _wasKilled = new(); //DeltaV Port from EE + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnGetProgress); + SubscribeLocalEvent(OnPersonAssigned); + SubscribeLocalEvent(OnHeadAssigned); + SubscribeLocalEvent(OnRoundEnd); //DeltaV Kill objective + } + + private void OnGetProgress(EntityUid uid, TeachLessonConditionComponent comp, ref ObjectiveGetProgressEvent args) + { + if (!_target.GetTarget(uid, out var target)) + return; + + args.Progress = GetProgress(target.Value, comp.RequireDead); + } + + private void OnPersonAssigned(EntityUid uid, TeachPickRandomPersonComponent comp, ref ObjectiveAssignedEvent args) + { + AssignRandomTarget(uid, args, _ => true); + } + + private void OnHeadAssigned(EntityUid uid, TeachPickRandomHeadComponent comp, ref ObjectiveAssignedEvent args) + { + AssignRandomTarget(uid, args, mind => HasComp(uid)); + } + + private void AssignRandomTarget(EntityUid uid, ObjectiveAssignedEvent args, Predicate filter, bool fallbackToAny = true) + { + // invalid prototype + if (!TryComp(uid, out var target)) + { + args.Cancelled = true; + return; + } + + // target already assigned + if (target.Target != null) + return; + + // Get all alive humans, filter out any with TargetObjectiveImmuneComponent + var allHumans = _mind.GetAliveHumansExcept(args.MindId) + .Where(mindId => + { + if (!TryComp(mindId, out var mindComp) || mindComp.OwnedEntity == null) + return false; + return !HasComp(mindComp.OwnedEntity.Value); + }) + .ToList(); + + // Filter out targets based on the filter + var filteredHumans = allHumans.Where(mind => filter(mind)).ToList(); + + // There's no humans and we can't fall back to any other target + if (filteredHumans.Count == 0 && !fallbackToAny) + { + args.Cancelled = true; + return; + } + + // Pick between humans matching our filter or fall back to all humans alive + var selectedHumans = filteredHumans.Count > 0 ? filteredHumans : allHumans; + + _target.SetTarget(uid, _random.Pick(selectedHumans), target); + } + // DeltaV - start making people only die once from EE + private float GetProgress(EntityUid target, bool requireDead) + { + // deleted or gibbed or something, counts as dead + if (!TryComp(target, out var mind) || mind.OwnedEntity == null) + { + if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); + return 1f; + } + + // dead is success + if (_mind.IsCharacterDeadIc(mind)) + { + if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); + return 1f; + } + + return 0f; + } + // if the target has to be dead dead then don't check evac stuff +// if (requireDead) +// return 0f; + + // if evac is disabled then they really do have to be dead +// if (!_config.GetCVar(CCVars.EmergencyShuttleEnabled)) +// return 0f; + + // target is escaping so you fail +// if (_emergencyShuttle.IsTargetEscaping(mind.OwnedEntity.Value)) +// return 0f; +// +// // evac has left without the target, greentext since the target is afk in space with a full oxygen tank and coordinates off. +// if (_emergencyShuttle.ShuttlesLeft) +// return 1f; +// +// // if evac is still here and target hasn't boarded, show 50% to give you an indicator that you are doing good +// return _emergencyShuttle.EmergencyShuttleArrived ? 0.5f : 0f; + // Clear the wasKilled list on round end + private void OnRoundEnd(RoundRestartCleanupEvent ev) + => _wasKilled.Clear(); + // DeltaV - end making people only die once from EE +} diff --git a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs index 42e4a6db715..d61310908c3 100644 --- a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs +++ b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs @@ -1,7 +1,5 @@ using System.Linq; using Content.Server.Objectives.Components; -using Content.Server.GameTicking; //DeltaV port from EE -using Content.Server.Station.Systems; //DeltaV port from EE using Content.Server.Revolutionary.Components; using Content.Server.Shuttles.Systems; using Content.Shared.CCVar; @@ -23,8 +21,6 @@ public sealed class KillPersonConditionSystem : EntitySystem [Dependency] private readonly SharedMindSystem _mind = default!; [Dependency] private readonly TargetObjectiveSystem _target = default!; - private List _wasKilled = new(); //DeltaV Port from EE - public override void Initialize() { base.Initialize(); @@ -32,7 +28,6 @@ public override void Initialize() SubscribeLocalEvent(OnGetProgress); SubscribeLocalEvent(OnPersonAssigned); SubscribeLocalEvent(OnHeadAssigned); - SubscribeLocalEvent(OnRoundEnd); //DeltaV Kill objective } private void OnGetProgress(EntityUid uid, KillPersonConditionComponent comp, ref ObjectiveGetProgressEvent args) @@ -91,45 +86,34 @@ private void AssignRandomTarget(EntityUid uid, ObjectiveAssignedEvent args, Pred _target.SetTarget(uid, _random.Pick(selectedHumans), target); } - // DeltaV - start making people only die once from EE + private float GetProgress(EntityUid target, bool requireDead) { // deleted or gibbed or something, counts as dead if (!TryComp(target, out var mind) || mind.OwnedEntity == null) - { - if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); return 1f; - } // dead is success if (_mind.IsCharacterDeadIc(mind)) - { - if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); return 1f; - } - - return 0f; - } + // if the target has to be dead dead then don't check evac stuff -// if (requireDead) -// return 0f; + if (requireDead) + return 0f; // if evac is disabled then they really do have to be dead -// if (!_config.GetCVar(CCVars.EmergencyShuttleEnabled)) -// return 0f; + if (!_config.GetCVar(CCVars.EmergencyShuttleEnabled)) + return 0f; // target is escaping so you fail -// if (_emergencyShuttle.IsTargetEscaping(mind.OwnedEntity.Value)) -// return 0f; -// -// // evac has left without the target, greentext since the target is afk in space with a full oxygen tank and coordinates off. -// if (_emergencyShuttle.ShuttlesLeft) -// return 1f; -// -// // if evac is still here and target hasn't boarded, show 50% to give you an indicator that you are doing good -// return _emergencyShuttle.EmergencyShuttleArrived ? 0.5f : 0f; - // Clear the wasKilled list on round end - private void OnRoundEnd(RoundRestartCleanupEvent ev) - => _wasKilled.Clear(); - // DeltaV - end making people only die once from EE + if (_emergencyShuttle.IsTargetEscaping(mind.OwnedEntity.Value)) + return 0f; + + // evac has left without the target, greentext since the target is afk in space with a full oxygen tank and coordinates off. + if (_emergencyShuttle.ShuttlesLeft) + return 1f; + + // if evac is still here and target hasn't boarded, show 50% to give you an indicator that you are doing good + return _emergencyShuttle.EmergencyShuttleArrived ? 0.5f : 0f; + } } diff --git a/Resources/Locale/en-US/deltav/objectives/conditions/teach-head.ftl b/Resources/Locale/en-US/deltav/objectives/conditions/teach-head.ftl new file mode 100644 index 00000000000..2ea83c65d76 --- /dev/null +++ b/Resources/Locale/en-US/deltav/objectives/conditions/teach-head.ftl @@ -0,0 +1 @@ +objective-condition-kill-teach-title = Kill {$targetName}, {CAPITALIZE($job)} diff --git a/Resources/Locale/en-US/deltav/objectives/conditions/teach-person.ftl b/Resources/Locale/en-US/deltav/objectives/conditions/teach-person.ftl new file mode 100644 index 00000000000..292db0a91ac --- /dev/null +++ b/Resources/Locale/en-US/deltav/objectives/conditions/teach-person.ftl @@ -0,0 +1 @@ +objective-condition-teach-person-title = Teach {$targetName}, {CAPITALIZE($job)} a lesson diff --git a/Resources/Locale/en-US/objectives/conditions/kill-person.ftl b/Resources/Locale/en-US/objectives/conditions/kill-person.ftl index 3b1c72c9543..c48e2122ff4 100644 --- a/Resources/Locale/en-US/objectives/conditions/kill-person.ftl +++ b/Resources/Locale/en-US/objectives/conditions/kill-person.ftl @@ -1 +1 @@ -objective-condition-kill-person-title = Teach {$targetName}, {CAPITALIZE($job)} a lesson +objective-condition-kill-person-title = Kill or maroon {$targetName}, {CAPITALIZE($job)} diff --git a/Resources/Prototypes/DeltaV/Objectives/traitor.yml b/Resources/Prototypes/DeltaV/Objectives/traitor.yml index cb8f5455823..8d0bc2715b7 100644 --- a/Resources/Prototypes/DeltaV/Objectives/traitor.yml +++ b/Resources/Prototypes/DeltaV/Objectives/traitor.yml @@ -50,3 +50,36 @@ - type: StealCondition stealGroup: AnimalSilvia owner: job-name-cmo + +# teach lesson + +- type: entity + parent: KillRandomPersonObjective + id: TeachRandomPersonObjective + description: Kill them, and show everyone we mean business. They only need to die once. #DeltaV change to reflect that people only gotta die once. + components: + - type: Objective + difficulty: 1.75 + unique: false + - type: TargetObjective + title: objective-condition-teach-person-title + - type: PickRandomPerson + - type: TeachLessonCondition #DeltaV change to teach lesson + +- type: entity + parent: KillRandomHeadObjective + id: TeachRandomHeadObjective + description: We need this head gone and you probably know why. Good luck, agent. + components: + - type: Objective + # technically its still possible for KillRandomPersonObjective to roll a head but this is guaranteed, so higher difficulty + difficulty: 3.0 + # killing 1 head is enough + unique: true + - type: TargetObjective + title: objective-condition-teach-head-title + - type: PickRandomHead + - type: TeachLessonCondition #DeltaV change to teach lesson + # don't count missing evac as killing as heads are higher profile, so you really need to do the dirty work + # if ce flies a shittle to centcom you better find a way onto it + requireDead: true diff --git a/Resources/Prototypes/Objectives/objectiveGroups.yml b/Resources/Prototypes/Objectives/objectiveGroups.yml index d870db5d364..988da766273 100644 --- a/Resources/Prototypes/Objectives/objectiveGroups.yml +++ b/Resources/Prototypes/Objectives/objectiveGroups.yml @@ -32,8 +32,10 @@ - type: weightedRandom id: TraitorObjectiveGroupKill weights: - KillRandomPersonObjective: 1 - KillRandomHeadObjective: 0.25 + # KillRandomPersonObjective: 1 DeltaV- Replaced for Teach Lesson + TeachRandomPersonObjective: 1 + # KillRandomHeadObjective: 0.25 DeltaV- Replaced for Teach Lesson + TeachRandomHeadObjective: 0.25 - type: weightedRandom id: TraitorObjectiveGroupState From 5a28a441152263cdf51ed8e842ff9667fc74a633 Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:17:04 -0500 Subject: [PATCH 05/11] bogos binted --- .../objectives/conditions/teach-head.ftl | 2 +- .../DeltaV/Objectives/base_objectives.yml | 26 +++++++++++++++++++ .../Prototypes/DeltaV/Objectives/traitor.yml | 8 +++--- Resources/Prototypes/Objectives/traitor.yml | 2 +- 4 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 Resources/Prototypes/DeltaV/Objectives/base_objectives.yml diff --git a/Resources/Locale/en-US/deltav/objectives/conditions/teach-head.ftl b/Resources/Locale/en-US/deltav/objectives/conditions/teach-head.ftl index 2ea83c65d76..7553f30e030 100644 --- a/Resources/Locale/en-US/deltav/objectives/conditions/teach-head.ftl +++ b/Resources/Locale/en-US/deltav/objectives/conditions/teach-head.ftl @@ -1 +1 @@ -objective-condition-kill-teach-title = Kill {$targetName}, {CAPITALIZE($job)} +objective-condition-teach-teach-title = Kill {$targetName}, {CAPITALIZE($job)} diff --git a/Resources/Prototypes/DeltaV/Objectives/base_objectives.yml b/Resources/Prototypes/DeltaV/Objectives/base_objectives.yml new file mode 100644 index 00000000000..1716e1ea711 --- /dev/null +++ b/Resources/Prototypes/DeltaV/Objectives/base_objectives.yml @@ -0,0 +1,26 @@ +# OBJECTIVE STYLE +# in comments anything that says final prototype means the objective that isnt abstract. +# you dont need noSpawn because Objectives category is automatically added, which has hideSpawnmenu +# components are listed in this order: +# 1. Objective +# 2. requirement components +# 3. non-condition components +# 4. the condition component + +# requires that the player kill someone +# disables social objectives and is disabled by social objectives +- type: entity + abstract: true + parent: BaseTargetObjective + id: BaseTeachObjective + components: + - type: Objective + unique: false + icon: + sprite: Objects/Weapons/Guns/Pistols/viper.rsi + state: icon + - type: ObjectiveBlacklistRequirement + blacklist: + components: + - SocialObjective + - type: TeachLessonCondition diff --git a/Resources/Prototypes/DeltaV/Objectives/traitor.yml b/Resources/Prototypes/DeltaV/Objectives/traitor.yml index 8d0bc2715b7..2ca3ee15827 100644 --- a/Resources/Prototypes/DeltaV/Objectives/traitor.yml +++ b/Resources/Prototypes/DeltaV/Objectives/traitor.yml @@ -54,7 +54,7 @@ # teach lesson - type: entity - parent: KillRandomPersonObjective + parent: BaseTeachObjective id: TeachRandomPersonObjective description: Kill them, and show everyone we mean business. They only need to die once. #DeltaV change to reflect that people only gotta die once. components: @@ -63,11 +63,11 @@ unique: false - type: TargetObjective title: objective-condition-teach-person-title - - type: PickRandomPerson + - type: TeachPickRandomPerson - type: TeachLessonCondition #DeltaV change to teach lesson - type: entity - parent: KillRandomHeadObjective + parent: BaseTeachObjective id: TeachRandomHeadObjective description: We need this head gone and you probably know why. Good luck, agent. components: @@ -78,7 +78,7 @@ unique: true - type: TargetObjective title: objective-condition-teach-head-title - - type: PickRandomHead + - type: TeachPickRandomHead - type: TeachLessonCondition #DeltaV change to teach lesson # don't count missing evac as killing as heads are higher profile, so you really need to do the dirty work # if ce flies a shittle to centcom you better find a way onto it diff --git a/Resources/Prototypes/Objectives/traitor.yml b/Resources/Prototypes/Objectives/traitor.yml index 3b6b76875ce..3acfb04d244 100644 --- a/Resources/Prototypes/Objectives/traitor.yml +++ b/Resources/Prototypes/Objectives/traitor.yml @@ -88,7 +88,7 @@ - type: entity parent: [BaseTraitorObjective, BaseKillObjective] id: KillRandomPersonObjective - description: Kill them, and show everyone we mean business. They only need to die once. #DeltaV change to reflect that people only gotta die once. + description: Do it however you like, just make sure they don't make it to centcomm. components: - type: Objective difficulty: 1.75 From d44873c8613a4549db2fd72851b172e760784e94 Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:49:15 -0500 Subject: [PATCH 06/11] bogos binted --- ...ent.cs => TeachLessonPickRandomHeadComponent.cs} | 2 +- ...t.cs => TeachLessonPickRandomPersonComponent.cs} | 2 +- .../Systems/TeachLessonConditionSystem.cs | 8 ++++---- .../DeltaV/Objectives/base_objectives.yml | 2 +- Resources/Prototypes/DeltaV/Objectives/traitor.yml | 13 ++++++------- 5 files changed, 13 insertions(+), 14 deletions(-) rename Content.Server/DeltaV/Objectives/Components/{TeachPickRandomHeadComponent.cs => TeachLessonPickRandomHeadComponent.cs} (81%) rename Content.Server/DeltaV/Objectives/Components/{TeachPickRandomPersonComponent.cs => TeachLessonPickRandomPersonComponent.cs} (77%) diff --git a/Content.Server/DeltaV/Objectives/Components/TeachPickRandomHeadComponent.cs b/Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomHeadComponent.cs similarity index 81% rename from Content.Server/DeltaV/Objectives/Components/TeachPickRandomHeadComponent.cs rename to Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomHeadComponent.cs index 1ce0aaa385b..da9337df697 100644 --- a/Content.Server/DeltaV/Objectives/Components/TeachPickRandomHeadComponent.cs +++ b/Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomHeadComponent.cs @@ -7,6 +7,6 @@ namespace Content.Server.Objectives.Components; /// If there are no heads it will fallback to any person. /// [RegisterComponent, Access(typeof(TeachLessonConditionSystem))] -public sealed partial class TeachPickRandomHeadComponent : Component +public sealed partial class TeachLessonPickRandomHeadComponent : Component { } diff --git a/Content.Server/DeltaV/Objectives/Components/TeachPickRandomPersonComponent.cs b/Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomPersonComponent.cs similarity index 77% rename from Content.Server/DeltaV/Objectives/Components/TeachPickRandomPersonComponent.cs rename to Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomPersonComponent.cs index 06ee763ae62..ef591fb9e3c 100644 --- a/Content.Server/DeltaV/Objectives/Components/TeachPickRandomPersonComponent.cs +++ b/Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomPersonComponent.cs @@ -6,6 +6,6 @@ namespace Content.Server.Objectives.Components; /// Sets the target for to a random person. /// [RegisterComponent, Access(typeof(TeachLessonConditionSystem))] -public sealed partial class TeachPickRandomPersonComponent : Component +public sealed partial class TeachLessonPickRandomPersonComponent : Component { } diff --git a/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs b/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs index 3664b7d2e49..23e5a141b70 100644 --- a/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs +++ b/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs @@ -28,8 +28,8 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(OnGetProgress); - SubscribeLocalEvent(OnPersonAssigned); - SubscribeLocalEvent(OnHeadAssigned); + SubscribeLocalEvent(OnPersonAssigned); + SubscribeLocalEvent(OnHeadAssigned); SubscribeLocalEvent(OnRoundEnd); //DeltaV Kill objective } @@ -41,12 +41,12 @@ private void OnGetProgress(EntityUid uid, TeachLessonConditionComponent comp, re args.Progress = GetProgress(target.Value, comp.RequireDead); } - private void OnPersonAssigned(EntityUid uid, TeachPickRandomPersonComponent comp, ref ObjectiveAssignedEvent args) + private void OnPersonAssigned(EntityUid uid, TeachLessonPickRandomPersonComponent comp, ref ObjectiveAssignedEvent args) { AssignRandomTarget(uid, args, _ => true); } - private void OnHeadAssigned(EntityUid uid, TeachPickRandomHeadComponent comp, ref ObjectiveAssignedEvent args) + private void OnHeadAssigned(EntityUid uid, TeachLessonPickRandomHeadComponent comp, ref ObjectiveAssignedEvent args) { AssignRandomTarget(uid, args, mind => HasComp(uid)); } diff --git a/Resources/Prototypes/DeltaV/Objectives/base_objectives.yml b/Resources/Prototypes/DeltaV/Objectives/base_objectives.yml index 1716e1ea711..db72f8fad27 100644 --- a/Resources/Prototypes/DeltaV/Objectives/base_objectives.yml +++ b/Resources/Prototypes/DeltaV/Objectives/base_objectives.yml @@ -12,7 +12,7 @@ - type: entity abstract: true parent: BaseTargetObjective - id: BaseTeachObjective + id: BaseTeachLessonObjective components: - type: Objective unique: false diff --git a/Resources/Prototypes/DeltaV/Objectives/traitor.yml b/Resources/Prototypes/DeltaV/Objectives/traitor.yml index 2ca3ee15827..ce077d1ae64 100644 --- a/Resources/Prototypes/DeltaV/Objectives/traitor.yml +++ b/Resources/Prototypes/DeltaV/Objectives/traitor.yml @@ -54,8 +54,8 @@ # teach lesson - type: entity - parent: BaseTeachObjective - id: TeachRandomPersonObjective + parent: BaseTeachLessonObjective + id: TeachLessonRandomPersonObjective description: Kill them, and show everyone we mean business. They only need to die once. #DeltaV change to reflect that people only gotta die once. components: - type: Objective @@ -63,12 +63,11 @@ unique: false - type: TargetObjective title: objective-condition-teach-person-title - - type: TeachPickRandomPerson - - type: TeachLessonCondition #DeltaV change to teach lesson + - type: TeachLessonPickRandomPerson - type: entity - parent: BaseTeachObjective - id: TeachRandomHeadObjective + parent: BaseTeachLessonObjective + id: TeachLessonRandomHeadObjective description: We need this head gone and you probably know why. Good luck, agent. components: - type: Objective @@ -78,7 +77,7 @@ unique: true - type: TargetObjective title: objective-condition-teach-head-title - - type: TeachPickRandomHead + - type: TeachLessonPickRandomHead - type: TeachLessonCondition #DeltaV change to teach lesson # don't count missing evac as killing as heads are higher profile, so you really need to do the dirty work # if ce flies a shittle to centcom you better find a way onto it From 8893057a38baaceff6ee3199863472f0da516704 Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:30:31 -0500 Subject: [PATCH 07/11] bogos binted --- .../DeltaV/Objectives/base_objectives.yml | 26 ------------------- .../Prototypes/DeltaV/Objectives/traitor.yml | 20 ++++++++++++-- 2 files changed, 18 insertions(+), 28 deletions(-) delete mode 100644 Resources/Prototypes/DeltaV/Objectives/base_objectives.yml diff --git a/Resources/Prototypes/DeltaV/Objectives/base_objectives.yml b/Resources/Prototypes/DeltaV/Objectives/base_objectives.yml deleted file mode 100644 index db72f8fad27..00000000000 --- a/Resources/Prototypes/DeltaV/Objectives/base_objectives.yml +++ /dev/null @@ -1,26 +0,0 @@ -# OBJECTIVE STYLE -# in comments anything that says final prototype means the objective that isnt abstract. -# you dont need noSpawn because Objectives category is automatically added, which has hideSpawnmenu -# components are listed in this order: -# 1. Objective -# 2. requirement components -# 3. non-condition components -# 4. the condition component - -# requires that the player kill someone -# disables social objectives and is disabled by social objectives -- type: entity - abstract: true - parent: BaseTargetObjective - id: BaseTeachLessonObjective - components: - - type: Objective - unique: false - icon: - sprite: Objects/Weapons/Guns/Pistols/viper.rsi - state: icon - - type: ObjectiveBlacklistRequirement - blacklist: - components: - - SocialObjective - - type: TeachLessonCondition diff --git a/Resources/Prototypes/DeltaV/Objectives/traitor.yml b/Resources/Prototypes/DeltaV/Objectives/traitor.yml index ce077d1ae64..2adf8151832 100644 --- a/Resources/Prototypes/DeltaV/Objectives/traitor.yml +++ b/Resources/Prototypes/DeltaV/Objectives/traitor.yml @@ -52,9 +52,24 @@ owner: job-name-cmo # teach lesson +- type: entity + abstract: true + parent: BaseTargetObjective + id: BaseTeachLessonObjective + components: + - type: Objective + unique: false + icon: + sprite: Objects/Weapons/Guns/Pistols/viper.rsi + state: icon + - type: ObjectiveBlacklistRequirement + blacklist: + components: + - SocialObjective + - type: entity - parent: BaseTeachLessonObjective + parent: [BaseTraitorObjective,BaseTeachLessonObjective] id: TeachLessonRandomPersonObjective description: Kill them, and show everyone we mean business. They only need to die once. #DeltaV change to reflect that people only gotta die once. components: @@ -64,9 +79,10 @@ - type: TargetObjective title: objective-condition-teach-person-title - type: TeachLessonPickRandomPerson + - type: TeachLessonCondition - type: entity - parent: BaseTeachLessonObjective + parent: [BaseTraitorObjective,BaseTeachLessonObjective] id: TeachLessonRandomHeadObjective description: We need this head gone and you probably know why. Good luck, agent. components: From 9b1f50b18fd8a8a6bfab9e2622509a3a923881b3 Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:58:18 -0500 Subject: [PATCH 08/11] fixes, still doesnt stay completed. --- .../TeachLessonConditionComponent.cs | 7 +- .../TeachLessonPickRandomHeadComponent.cs | 12 --- .../TeachLessonPickRandomPersonComponent.cs | 11 -- .../Systems/TeachLessonConditionSystem.cs | 100 ++---------------- .../Systems/KillPersonConditionSystem.cs | 2 +- .../objectives/conditions/teach-head.ftl | 1 - .../Prototypes/DeltaV/Objectives/traitor.yml | 21 +--- .../Prototypes/Objectives/objectiveGroups.yml | 7 +- 8 files changed, 16 insertions(+), 145 deletions(-) delete mode 100644 Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomHeadComponent.cs delete mode 100644 Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomPersonComponent.cs delete mode 100644 Resources/Locale/en-US/deltav/objectives/conditions/teach-head.ftl diff --git a/Content.Server/DeltaV/Objectives/Components/TeachLessonConditionComponent.cs b/Content.Server/DeltaV/Objectives/Components/TeachLessonConditionComponent.cs index 2f36759874b..c7907eb11cf 100644 --- a/Content.Server/DeltaV/Objectives/Components/TeachLessonConditionComponent.cs +++ b/Content.Server/DeltaV/Objectives/Components/TeachLessonConditionComponent.cs @@ -3,15 +3,10 @@ namespace Content.Server.Objectives.Components; /// -/// Requires that a target dies or, if is false, is not on the emergency shuttle. +/// Requires that a target dies once and only once. /// Depends on to function. /// [RegisterComponent, Access(typeof(TeachLessonConditionSystem))] public sealed partial class TeachLessonConditionComponent : Component { - /// - /// Whether the target must be truly dead, ignores missing evac. - /// - [DataField, ViewVariables(VVAccess.ReadWrite)] - public bool RequireDead = false; } diff --git a/Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomHeadComponent.cs b/Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomHeadComponent.cs deleted file mode 100644 index da9337df697..00000000000 --- a/Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomHeadComponent.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Content.Server.Objectives.Systems; - -namespace Content.Server.Objectives.Components; - -/// -/// Sets the target for to a random head. -/// If there are no heads it will fallback to any person. -/// -[RegisterComponent, Access(typeof(TeachLessonConditionSystem))] -public sealed partial class TeachLessonPickRandomHeadComponent : Component -{ -} diff --git a/Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomPersonComponent.cs b/Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomPersonComponent.cs deleted file mode 100644 index ef591fb9e3c..00000000000 --- a/Content.Server/DeltaV/Objectives/Components/TeachLessonPickRandomPersonComponent.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Content.Server.Objectives.Systems; - -namespace Content.Server.Objectives.Components; - -/// -/// Sets the target for to a random person. -/// -[RegisterComponent, Access(typeof(TeachLessonConditionSystem))] -public sealed partial class TeachLessonPickRandomPersonComponent : Component -{ -} diff --git a/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs b/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs index 23e5a141b70..542cd8e0a36 100644 --- a/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs +++ b/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs @@ -1,11 +1,7 @@ -using System.Linq; -using Content.Server.Objectives.Components; -using Content.Shared.GameTicking; //DeltaV Teach lesson -using Content.Server.Revolutionary.Components; -using Content.Server.Shuttles.Systems; +using Content.Server.Objectives.Components; +using Content.Shared.GameTicking; using Content.Shared.Mind; using Content.Shared.Objectives.Components; -using Robust.Shared.Configuration; using Robust.Shared.Random; namespace Content.Server.Objectives.Systems; @@ -15,8 +11,6 @@ namespace Content.Server.Objectives.Systems; /// public sealed class TeachLessonConditionSystem : EntitySystem { - [Dependency] private readonly EmergencyShuttleSystem _emergencyShuttle = default!; - [Dependency] private readonly IConfigurationManager _config = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly SharedMindSystem _mind = default!; [Dependency] private readonly TargetObjectiveSystem _target = default!; @@ -28,9 +22,7 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(OnGetProgress); - SubscribeLocalEvent(OnPersonAssigned); - SubscribeLocalEvent(OnHeadAssigned); - SubscribeLocalEvent(OnRoundEnd); //DeltaV Kill objective + SubscribeLocalEvent(OnRoundEnd); } private void OnGetProgress(EntityUid uid, TeachLessonConditionComponent comp, ref ObjectiveGetProgressEvent args) @@ -38,96 +30,24 @@ private void OnGetProgress(EntityUid uid, TeachLessonConditionComponent comp, re if (!_target.GetTarget(uid, out var target)) return; - args.Progress = GetProgress(target.Value, comp.RequireDead); + args.Progress = GetProgress(target.Value); } - private void OnPersonAssigned(EntityUid uid, TeachLessonPickRandomPersonComponent comp, ref ObjectiveAssignedEvent args) - { - AssignRandomTarget(uid, args, _ => true); - } - - private void OnHeadAssigned(EntityUid uid, TeachLessonPickRandomHeadComponent comp, ref ObjectiveAssignedEvent args) - { - AssignRandomTarget(uid, args, mind => HasComp(uid)); - } - - private void AssignRandomTarget(EntityUid uid, ObjectiveAssignedEvent args, Predicate filter, bool fallbackToAny = true) - { - // invalid prototype - if (!TryComp(uid, out var target)) - { - args.Cancelled = true; - return; - } - - // target already assigned - if (target.Target != null) - return; - - // Get all alive humans, filter out any with TargetObjectiveImmuneComponent - var allHumans = _mind.GetAliveHumansExcept(args.MindId) - .Where(mindId => - { - if (!TryComp(mindId, out var mindComp) || mindComp.OwnedEntity == null) - return false; - return !HasComp(mindComp.OwnedEntity.Value); - }) - .ToList(); - - // Filter out targets based on the filter - var filteredHumans = allHumans.Where(mind => filter(mind)).ToList(); - - // There's no humans and we can't fall back to any other target - if (filteredHumans.Count == 0 && !fallbackToAny) - { - args.Cancelled = true; - return; - } - - // Pick between humans matching our filter or fall back to all humans alive - var selectedHumans = filteredHumans.Count > 0 ? filteredHumans : allHumans; - - _target.SetTarget(uid, _random.Pick(selectedHumans), target); - } - // DeltaV - start making people only die once from EE - private float GetProgress(EntityUid target, bool requireDead) + private float GetProgress(EntityUid target) { // deleted or gibbed or something, counts as dead - if (!TryComp(target, out var mind) || mind.OwnedEntity == null) - { - if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); - return 1f; - } - - // dead is success - if (_mind.IsCharacterDeadIc(mind)) + if (!TryComp(target, out var mind) || mind.OwnedEntity == null || _mind.IsCharacterDeadIc(mind) || !_wasKilled.Contains(target)) { - if (!requireDead && !_wasKilled.Contains(target)) _wasKilled.Add(target); + _wasKilled.Add(target); return 1f; } return 0f; } - // if the target has to be dead dead then don't check evac stuff -// if (requireDead) -// return 0f; - - // if evac is disabled then they really do have to be dead -// if (!_config.GetCVar(CCVars.EmergencyShuttleEnabled)) -// return 0f; - - // target is escaping so you fail -// if (_emergencyShuttle.IsTargetEscaping(mind.OwnedEntity.Value)) -// return 0f; -// -// // evac has left without the target, greentext since the target is afk in space with a full oxygen tank and coordinates off. -// if (_emergencyShuttle.ShuttlesLeft) -// return 1f; -// -// // if evac is still here and target hasn't boarded, show 50% to give you an indicator that you are doing good -// return _emergencyShuttle.EmergencyShuttleArrived ? 0.5f : 0f; // Clear the wasKilled list on round end private void OnRoundEnd(RoundRestartCleanupEvent ev) - => _wasKilled.Clear(); + { + _wasKilled.Clear(); + } // DeltaV - end making people only die once from EE } diff --git a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs index d61310908c3..13f0d18fc21 100644 --- a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs +++ b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs @@ -38,7 +38,7 @@ private void OnGetProgress(EntityUid uid, KillPersonConditionComponent comp, ref args.Progress = GetProgress(target.Value, comp.RequireDead); } - private void OnPersonAssigned(EntityUid uid, PickRandomPersonComponent comp, ref ObjectiveAssignedEvent args) + public void OnPersonAssigned(EntityUid uid, PickRandomPersonComponent comp, ref ObjectiveAssignedEvent args) { AssignRandomTarget(uid, args, _ => true); } diff --git a/Resources/Locale/en-US/deltav/objectives/conditions/teach-head.ftl b/Resources/Locale/en-US/deltav/objectives/conditions/teach-head.ftl deleted file mode 100644 index 7553f30e030..00000000000 --- a/Resources/Locale/en-US/deltav/objectives/conditions/teach-head.ftl +++ /dev/null @@ -1 +0,0 @@ -objective-condition-teach-teach-title = Kill {$targetName}, {CAPITALIZE($job)} diff --git a/Resources/Prototypes/DeltaV/Objectives/traitor.yml b/Resources/Prototypes/DeltaV/Objectives/traitor.yml index 2adf8151832..9d73235ffab 100644 --- a/Resources/Prototypes/DeltaV/Objectives/traitor.yml +++ b/Resources/Prototypes/DeltaV/Objectives/traitor.yml @@ -67,7 +67,6 @@ components: - SocialObjective - - type: entity parent: [BaseTraitorObjective,BaseTeachLessonObjective] id: TeachLessonRandomPersonObjective @@ -78,23 +77,5 @@ unique: false - type: TargetObjective title: objective-condition-teach-person-title - - type: TeachLessonPickRandomPerson + - type: PickRandomPerson - type: TeachLessonCondition - -- type: entity - parent: [BaseTraitorObjective,BaseTeachLessonObjective] - id: TeachLessonRandomHeadObjective - description: We need this head gone and you probably know why. Good luck, agent. - components: - - type: Objective - # technically its still possible for KillRandomPersonObjective to roll a head but this is guaranteed, so higher difficulty - difficulty: 3.0 - # killing 1 head is enough - unique: true - - type: TargetObjective - title: objective-condition-teach-head-title - - type: TeachLessonPickRandomHead - - type: TeachLessonCondition #DeltaV change to teach lesson - # don't count missing evac as killing as heads are higher profile, so you really need to do the dirty work - # if ce flies a shittle to centcom you better find a way onto it - requireDead: true diff --git a/Resources/Prototypes/Objectives/objectiveGroups.yml b/Resources/Prototypes/Objectives/objectiveGroups.yml index 988da766273..60413cc6ab2 100644 --- a/Resources/Prototypes/Objectives/objectiveGroups.yml +++ b/Resources/Prototypes/Objectives/objectiveGroups.yml @@ -32,10 +32,9 @@ - type: weightedRandom id: TraitorObjectiveGroupKill weights: - # KillRandomPersonObjective: 1 DeltaV- Replaced for Teach Lesson - TeachRandomPersonObjective: 1 - # KillRandomHeadObjective: 0.25 DeltaV- Replaced for Teach Lesson - TeachRandomHeadObjective: 0.25 + #KillRandomPersonObjective: 1 DeltaV- Replaced for Teach Lesson + TeachLessonRandomPersonObjective: 1 + KillRandomHeadObjective: 0.25 - type: weightedRandom id: TraitorObjectiveGroupState From 2a4ecff6c45f3c762415b8766f0451e81dcc5395 Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Thu, 14 Nov 2024 17:26:07 -0500 Subject: [PATCH 09/11] fixed real --- .../Objectives/Systems/TeachLessonConditionSystem.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs b/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs index 542cd8e0a36..65447578e36 100644 --- a/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs +++ b/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs @@ -2,16 +2,14 @@ using Content.Shared.GameTicking; using Content.Shared.Mind; using Content.Shared.Objectives.Components; -using Robust.Shared.Random; namespace Content.Server.Objectives.Systems; /// -/// Handles kill person condition logic and picking random kill targets. +/// Handles teach a lesson condition logic, does not assign target. /// public sealed class TeachLessonConditionSystem : EntitySystem { - [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly SharedMindSystem _mind = default!; [Dependency] private readonly TargetObjectiveSystem _target = default!; @@ -36,12 +34,15 @@ private void OnGetProgress(EntityUid uid, TeachLessonConditionComponent comp, re private float GetProgress(EntityUid target) { // deleted or gibbed or something, counts as dead - if (!TryComp(target, out var mind) || mind.OwnedEntity == null || _mind.IsCharacterDeadIc(mind) || !_wasKilled.Contains(target)) + if (!TryComp(target, out var mind) || mind.OwnedEntity == null || _mind.IsCharacterDeadIc(mind)) { _wasKilled.Add(target); return 1f; } - + if (_wasKilled.Contains(target)) + { + return 1f; + } return 0f; } // Clear the wasKilled list on round end From 4e3425a54dad915e05c683a694dacbb6a08e9de8 Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Thu, 14 Nov 2024 23:49:50 -0500 Subject: [PATCH 10/11] meow --- .../Components/TeachLessonConditionComponent.cs | 4 +--- .../Objectives/Systems/TeachLessonConditionSystem.cs | 10 +++++----- .../Objectives/Systems/KillPersonConditionSystem.cs | 2 +- Resources/Prototypes/DeltaV/Objectives/traitor.yml | 4 ++-- Resources/Prototypes/Objectives/objectiveGroups.yml | 2 +- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Content.Server/DeltaV/Objectives/Components/TeachLessonConditionComponent.cs b/Content.Server/DeltaV/Objectives/Components/TeachLessonConditionComponent.cs index c7907eb11cf..ee86f4851b3 100644 --- a/Content.Server/DeltaV/Objectives/Components/TeachLessonConditionComponent.cs +++ b/Content.Server/DeltaV/Objectives/Components/TeachLessonConditionComponent.cs @@ -7,6 +7,4 @@ namespace Content.Server.Objectives.Components; /// Depends on to function. /// [RegisterComponent, Access(typeof(TeachLessonConditionSystem))] -public sealed partial class TeachLessonConditionComponent : Component -{ -} +public sealed partial class TeachLessonConditionComponent : Component; diff --git a/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs b/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs index 65447578e36..b722d382571 100644 --- a/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs +++ b/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs @@ -2,6 +2,7 @@ using Content.Shared.GameTicking; using Content.Shared.Mind; using Content.Shared.Objectives.Components; +using Microsoft.EntityFrameworkCore.Query.Internal; namespace Content.Server.Objectives.Systems; @@ -13,7 +14,7 @@ public sealed class TeachLessonConditionSystem : EntitySystem [Dependency] private readonly SharedMindSystem _mind = default!; [Dependency] private readonly TargetObjectiveSystem _target = default!; - private List _wasKilled = new(); //DeltaV Port from EE + private List _wasKilled = new(); public override void Initialize() { @@ -23,9 +24,9 @@ public override void Initialize() SubscribeLocalEvent(OnRoundEnd); } - private void OnGetProgress(EntityUid uid, TeachLessonConditionComponent comp, ref ObjectiveGetProgressEvent args) + private void OnGetProgress(Entity ent, ref ObjectiveGetProgressEvent args) { - if (!_target.GetTarget(uid, out var target)) + if (!_target.GetTarget(ent, out var target)) return; args.Progress = GetProgress(target.Value); @@ -41,7 +42,7 @@ private float GetProgress(EntityUid target) } if (_wasKilled.Contains(target)) { - return 1f; + return _wasKilled.Contains(target) ? 1f : 0f; } return 0f; } @@ -50,5 +51,4 @@ private void OnRoundEnd(RoundRestartCleanupEvent ev) { _wasKilled.Clear(); } - // DeltaV - end making people only die once from EE } diff --git a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs index 13f0d18fc21..d61310908c3 100644 --- a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs +++ b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs @@ -38,7 +38,7 @@ private void OnGetProgress(EntityUid uid, KillPersonConditionComponent comp, ref args.Progress = GetProgress(target.Value, comp.RequireDead); } - public void OnPersonAssigned(EntityUid uid, PickRandomPersonComponent comp, ref ObjectiveAssignedEvent args) + private void OnPersonAssigned(EntityUid uid, PickRandomPersonComponent comp, ref ObjectiveAssignedEvent args) { AssignRandomTarget(uid, args, _ => true); } diff --git a/Resources/Prototypes/DeltaV/Objectives/traitor.yml b/Resources/Prototypes/DeltaV/Objectives/traitor.yml index 9d73235ffab..28bd9a1f895 100644 --- a/Resources/Prototypes/DeltaV/Objectives/traitor.yml +++ b/Resources/Prototypes/DeltaV/Objectives/traitor.yml @@ -68,9 +68,9 @@ - SocialObjective - type: entity - parent: [BaseTraitorObjective,BaseTeachLessonObjective] + parent: [BaseTraitorObjective, BaseTeachLessonObjective] id: TeachLessonRandomPersonObjective - description: Kill them, and show everyone we mean business. They only need to die once. #DeltaV change to reflect that people only gotta die once. + description: Kill them, and show everyone we mean business. They only need to die once. components: - type: Objective difficulty: 1.75 diff --git a/Resources/Prototypes/Objectives/objectiveGroups.yml b/Resources/Prototypes/Objectives/objectiveGroups.yml index 60413cc6ab2..66e606f9d8e 100644 --- a/Resources/Prototypes/Objectives/objectiveGroups.yml +++ b/Resources/Prototypes/Objectives/objectiveGroups.yml @@ -32,7 +32,7 @@ - type: weightedRandom id: TraitorObjectiveGroupKill weights: - #KillRandomPersonObjective: 1 DeltaV- Replaced for Teach Lesson + #KillRandomPersonObjective: 1 # DeltaV- Replaced for Teach Lesson TeachLessonRandomPersonObjective: 1 KillRandomHeadObjective: 0.25 From 00cfa79a5f920109395ddd15f3932c53d6b034d3 Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Fri, 15 Nov 2024 10:58:40 -0500 Subject: [PATCH 11/11] meow --- .../Systems/TeachLessonConditionSystem.cs | 18 ++++++------------ .../Prototypes/Objectives/objectiveGroups.yml | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs b/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs index b722d382571..8e3ca19f885 100644 --- a/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs +++ b/Content.Server/DeltaV/Objectives/Systems/TeachLessonConditionSystem.cs @@ -2,7 +2,6 @@ using Content.Shared.GameTicking; using Content.Shared.Mind; using Content.Shared.Objectives.Components; -using Microsoft.EntityFrameworkCore.Query.Internal; namespace Content.Server.Objectives.Systems; @@ -14,7 +13,7 @@ public sealed class TeachLessonConditionSystem : EntitySystem [Dependency] private readonly SharedMindSystem _mind = default!; [Dependency] private readonly TargetObjectiveSystem _target = default!; - private List _wasKilled = new(); + private readonly List _wasKilled = []; public override void Initialize() { @@ -34,18 +33,13 @@ private void OnGetProgress(Entity ent, ref Object private float GetProgress(EntityUid target) { - // deleted or gibbed or something, counts as dead - if (!TryComp(target, out var mind) || mind.OwnedEntity == null || _mind.IsCharacterDeadIc(mind)) - { - _wasKilled.Add(target); - return 1f; - } - if (_wasKilled.Contains(target)) - { + if (TryComp(target, out var mind) && mind.OwnedEntity != null && !_mind.IsCharacterDeadIc(mind)) return _wasKilled.Contains(target) ? 1f : 0f; - } - return 0f; + + _wasKilled.Add(target); + return 1f; } + // Clear the wasKilled list on round end private void OnRoundEnd(RoundRestartCleanupEvent ev) { diff --git a/Resources/Prototypes/Objectives/objectiveGroups.yml b/Resources/Prototypes/Objectives/objectiveGroups.yml index 66e606f9d8e..bfc7122c6d6 100644 --- a/Resources/Prototypes/Objectives/objectiveGroups.yml +++ b/Resources/Prototypes/Objectives/objectiveGroups.yml @@ -32,7 +32,7 @@ - type: weightedRandom id: TraitorObjectiveGroupKill weights: - #KillRandomPersonObjective: 1 # DeltaV- Replaced for Teach Lesson + # KillRandomPersonObjective: 1 # DeltaV Replaced for Teach Lesson TeachLessonRandomPersonObjective: 1 KillRandomHeadObjective: 0.25