Skip to content

Commit 8cee94c

Browse files
committed
Alive bug
1 parent 9e076e0 commit 8cee94c

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

Content.Server/_CorvaxNext/VoxRaiders/Components/VoxRaidersRuleComponent.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public sealed partial class VoxRaidersRuleComponent : Component
1616
[DataField]
1717
public List<string> ObjectivePrototypes = [];
1818

19-
public Dictionary<string, List<(EntityUid Objective, Entity<MindComponent> Mind)>> Objectives = [];
19+
public List<EntityUid> Raiders = [];
20+
21+
public Dictionary<string, List<(EntityUid Objective, EntityUid Mind)>> Objectives = [];
2022

2123
public EntityUid Map;
2224

Content.Server/_CorvaxNext/VoxRaiders/EntitySystems/VoxRaidersRuleSystem.cs

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Linq;
21
using System.Text;
32
using Content.Server._CorvaxNext.VoxRaiders.Components;
43
using Content.Server.Antag;
@@ -63,7 +62,7 @@ protected override void AppendRoundEndText(EntityUid uid, VoxRaidersRuleComponen
6362
if (objectives.Count < 1)
6463
continue;
6564

66-
var info = _objectives.GetInfo(objectives[0].Objective, objectives[0].Mind, objectives[0].Mind);
65+
var info = _objectives.GetInfo(objectives[0].Objective, objectives[0].Mind);
6766

6867
if (info is null)
6968
continue;
@@ -81,6 +80,8 @@ private void OnAfterAntagEntitySelected(Entity<VoxRaidersRuleComponent> entity,
8180
if (mind is null)
8281
return;
8382

83+
entity.Comp.Raiders.Add(e.EntityUid);
84+
8485
var query = AllEntityQuery<VoxRaidersShuttleComponent, ExtractionShuttleComponent>();
8586
while (query.MoveNext(out var shuttle, out var extraction))
8687
if (shuttle.Rule == entity.Owner)
@@ -98,7 +99,7 @@ private void OnAfterAntagEntitySelected(Entity<VoxRaidersRuleComponent> entity,
9899

99100
_mind.AddObjective(mind.Value, mindComponent, obj.Value);
100101

101-
entity.Comp.Objectives.GetOrNew(objective).Add((obj.Value, (mind.Value, mindComponent)));
102+
entity.Comp.Objectives.GetOrNew(objective).Add((obj.Value, mind.Value));
102103
}
103104
}
104105

@@ -136,10 +137,19 @@ private void OnFTLCompleted(Entity<VoxRaidersShuttleComponent> entity, ref FTLCo
136137
return;
137138

138139
foreach (var objectives in rule.Objectives.Values)
139-
if (!objectives.All(objective => _objectives.IsCompleted(objective.Objective, objective.Mind)))
140+
foreach (var objective in objectives)
141+
if (TryComp<MindComponent>(objective.Mind, out var mind))
142+
if (!_objectives.IsCompleted(objective.Objective, (objective.Mind, mind)))
143+
return;
144+
145+
foreach (var raider in rule.Raiders)
146+
{
147+
if (!TryComp<ExtractionShuttleComponent>(Transform(raider).GridUid, out var shuttle))
140148
return;
141149

142-
Del(e.MapUid);
150+
if (!shuttle.Owners.Contains(raider))
151+
return;
152+
}
143153

144154
rule.Success = true;
145155
}

0 commit comments

Comments
 (0)