1
1
using Content . Server . Objectives . Components ;
2
- using Content . Server . Revolutionary . Components ;
3
2
using Content . Server . Shuttles . Systems ;
4
3
using Content . Shared . CCVar ;
5
4
using Content . Shared . Mind ;
6
5
using Content . Shared . Objectives . Components ;
7
6
using Robust . Shared . Configuration ;
8
- using Robust . Shared . Random ;
9
- using System . Linq ;
10
7
11
8
namespace Content . Server . Objectives . Systems ;
12
9
@@ -17,7 +14,6 @@ public sealed class KillPersonConditionSystem : EntitySystem
17
14
{
18
15
[ Dependency ] private readonly EmergencyShuttleSystem _emergencyShuttle = default ! ;
19
16
[ Dependency ] private readonly IConfigurationManager _config = default ! ;
20
- [ Dependency ] private readonly IRobustRandom _random = default ! ;
21
17
[ Dependency ] private readonly SharedMindSystem _mind = default ! ;
22
18
[ Dependency ] private readonly TargetObjectiveSystem _target = default ! ;
23
19
@@ -26,10 +22,6 @@ public override void Initialize()
26
22
base . Initialize ( ) ;
27
23
28
24
SubscribeLocalEvent < KillPersonConditionComponent , ObjectiveGetProgressEvent > ( OnGetProgress ) ;
29
-
30
- SubscribeLocalEvent < PickRandomPersonComponent , ObjectiveAssignedEvent > ( OnPersonAssigned ) ;
31
-
32
- SubscribeLocalEvent < PickRandomHeadComponent , ObjectiveAssignedEvent > ( OnHeadAssigned ) ;
33
25
}
34
26
35
27
private void OnGetProgress ( EntityUid uid , KillPersonConditionComponent comp , ref ObjectiveGetProgressEvent args )
@@ -40,74 +32,6 @@ private void OnGetProgress(EntityUid uid, KillPersonConditionComponent comp, ref
40
32
args . Progress = GetProgress ( target . Value , comp . RequireDead ) ;
41
33
}
42
34
43
- private void OnPersonAssigned ( EntityUid uid , PickRandomPersonComponent comp , ref ObjectiveAssignedEvent args )
44
- {
45
- // invalid objective prototype
46
- if ( ! TryComp < TargetObjectiveComponent > ( uid , out var target ) )
47
- {
48
- args . Cancelled = true ;
49
- return ;
50
- }
51
-
52
- // target already assigned
53
- if ( target . Target != null )
54
- return ;
55
-
56
- var allHumans = _mind . GetAliveHumans ( args . MindId ) ;
57
-
58
- // Can't have multiple objectives to kill the same person
59
- foreach ( var objective in args . Mind . Objectives )
60
- {
61
- if ( HasComp < KillPersonConditionComponent > ( objective ) & & TryComp < TargetObjectiveComponent > ( objective , out var kill ) )
62
- {
63
- allHumans . RemoveWhere ( x => x . Owner == kill . Target ) ;
64
- }
65
- }
66
-
67
- // no other humans to kill
68
- if ( allHumans . Count == 0 )
69
- {
70
- args . Cancelled = true ;
71
- return ;
72
- }
73
-
74
- _target . SetTarget ( uid , _random . Pick ( allHumans ) , target ) ;
75
- }
76
-
77
- private void OnHeadAssigned ( EntityUid uid , PickRandomHeadComponent comp , ref ObjectiveAssignedEvent args )
78
- {
79
- // invalid prototype
80
- if ( ! TryComp < TargetObjectiveComponent > ( uid , out var target ) )
81
- {
82
- args . Cancelled = true ;
83
- return ;
84
- }
85
-
86
- // target already assigned
87
- if ( target . Target != null )
88
- return ;
89
-
90
- // no other humans to kill
91
- var allHumans = _mind . GetAliveHumans ( args . MindId ) ;
92
- if ( allHumans . Count == 0 )
93
- {
94
- args . Cancelled = true ;
95
- return ;
96
- }
97
-
98
- var allHeads = new HashSet < Entity < MindComponent > > ( ) ;
99
- foreach ( var person in allHumans )
100
- {
101
- if ( TryComp < MindComponent > ( person , out var mind ) && mind . OwnedEntity is { } ent && HasComp < CommandStaffComponent > ( ent ) )
102
- allHeads . Add ( person ) ;
103
- }
104
-
105
- if ( allHeads . Count == 0 )
106
- allHeads = allHumans ; // fallback to non-head target
107
-
108
- _target . SetTarget ( uid , _random . Pick ( allHeads ) , target ) ;
109
- }
110
-
111
35
private float GetProgress ( EntityUid target , bool requireDead )
112
36
{
113
37
// deleted or gibbed or something, counts as dead
0 commit comments