Skip to content

Commit 6c69e65

Browse files
committed
Merge branch 'NukeOps' of https://github.com/anders0n9/anderstable into NukeOps
2 parents fe37566 + e859024 commit 6c69e65

File tree

192 files changed

+103919
-100326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+103919
-100326
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
2+
3+
using Content.Shared.Pinpointer;
4+
using Content.Shared.SS220.Pinpointer;
5+
using JetBrains.Annotations;
6+
using Robust.Client.UserInterface;
7+
8+
namespace Content.Client.SS220.Pinpointer.UI;
9+
10+
[UsedImplicitly]
11+
public sealed partial class PinpointerBoundUserInterface : BoundUserInterface
12+
{
13+
private PinpointerMenu? _crewMenu;
14+
private PinpointerUplinkMenu? _itemMenu;
15+
16+
public PinpointerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
17+
{
18+
}
19+
20+
protected override void UpdateState(BoundUserInterfaceState state)
21+
{
22+
base.UpdateState(state);
23+
24+
switch (state)
25+
{
26+
case PinpointerCrewUIState crewState:
27+
if (_crewMenu == null)
28+
return;
29+
30+
_crewMenu.CrewListCoords = crewState.Sensors;
31+
_crewMenu.PopulateList();
32+
break;
33+
34+
case PinpointerItemUIState itemState:
35+
if (_itemMenu == null)
36+
return;
37+
38+
_itemMenu.ItemListSet = itemState.Items;
39+
_itemMenu.PopulateList();
40+
break;
41+
}
42+
}
43+
44+
protected override void Open()
45+
{
46+
base.Open();
47+
48+
if (!EntMan.TryGetComponent<PinpointerComponent>(Owner, out var pinpointer))
49+
return;
50+
51+
switch (pinpointer.Mode)
52+
{
53+
case PinpointerMode.Crew:
54+
{
55+
_crewMenu = this.CreateWindow<PinpointerMenu>();
56+
_crewMenu.OnTargetPicked = OnTargetPicked;
57+
_crewMenu.PopulateList();
58+
break;
59+
}
60+
61+
case PinpointerMode.Item:
62+
{
63+
_itemMenu = this.CreateWindow<PinpointerUplinkMenu>();
64+
_itemMenu.OnTargetPicked = OnTargetPicked;
65+
_itemMenu.OnDnaPicked = OnDnaPicked;
66+
_itemMenu.PopulateList();
67+
break;
68+
}
69+
}
70+
}
71+
72+
protected override void Dispose(bool disposing)
73+
{
74+
base.Dispose(disposing);
75+
_crewMenu?.Close();
76+
_itemMenu?.Close();
77+
_itemMenu?.DnaWindow?.Close();
78+
}
79+
80+
private void OnTargetPicked(NetEntity target)
81+
{
82+
SendMessage(new PinpointerTargetPick(target));
83+
}
84+
85+
private void OnDnaPicked(string? dna)
86+
{
87+
SendMessage(new PinpointerDnaPick(dna));
88+
}
89+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<controls:FancyWindow xmlns="https://spacestation14.io"
2+
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
3+
Title="{Loc 'pinpointer-ui-title'}"
4+
MinSize="350 300"
5+
Resizable="True">
6+
7+
<BoxContainer Orientation="Vertical" VerticalExpand="True">
8+
<Label Text="{Loc 'pinpointer-ui-person-to-track'}" Name="LabelTrack" Access="Public" Margin="5 0 0 0" HorizontalExpand="True"/>
9+
<PanelContainer StyleClasses="HighDivider"/>
10+
11+
<ScrollContainer VerticalExpand="True" HScrollEnabled="False">
12+
<BoxContainer Name="CrewList" Orientation="Vertical"/>
13+
</ScrollContainer>
14+
<LineEdit Name="SearchBar" PlaceHolder="{Loc 'object-tab-object-search'}" HorizontalExpand="true"/>
15+
</BoxContainer>
16+
17+
</controls:FancyWindow>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
2+
3+
using Content.Client.UserInterface.Controls;
4+
using Content.Shared.SS220.Pinpointer;
5+
using Robust.Client.AutoGenerated;
6+
using Robust.Client.UserInterface.Controls;
7+
using Robust.Client.UserInterface.XAML;
8+
9+
namespace Content.Client.SS220.Pinpointer.UI;
10+
11+
[GenerateTypedNameReferences]
12+
public sealed partial class PinpointerMenu : FancyWindow
13+
{
14+
public Action<NetEntity>? OnTargetPicked;
15+
16+
public HashSet<TrackedItem> CrewListCoords = [];
17+
18+
private string _searchText = string.Empty;
19+
20+
public PinpointerMenu()
21+
{
22+
RobustXamlLoader.Load(this);
23+
IoCManager.InjectDependencies(this);
24+
25+
SearchBar.OnTextChanged += OnSearchChanged;
26+
}
27+
28+
private void OnSearchChanged(LineEdit.LineEditEventArgs args)
29+
{
30+
_searchText = args.Text.Trim().ToLower();
31+
PopulateList();
32+
}
33+
34+
public void PopulateList()
35+
{
36+
CrewList.RemoveAllChildren();
37+
38+
foreach (var entry in CrewListCoords)
39+
{
40+
var button = CreateTargetButton(entry.Name, () => OnTargetPicked?.Invoke(entry.Entity));
41+
42+
if (button == null)
43+
continue;
44+
45+
CrewList.AddChild(button);
46+
}
47+
}
48+
49+
private Button? CreateTargetButton(string fullName, Action onClick)
50+
{
51+
if (!fullName.Contains(_searchText, StringComparison.CurrentCultureIgnoreCase))
52+
return null;
53+
54+
var button = new Button
55+
{
56+
ToolTip = fullName,
57+
StyleClasses = { "OpenBoth" },
58+
SetHeight = 30,
59+
Margin = new Thickness(5, 0, 5, 5),
60+
HorizontalExpand = true,
61+
};
62+
63+
var label = new Label
64+
{
65+
Text = fullName,
66+
HorizontalExpand = true,
67+
HorizontalAlignment = HAlignment.Center,
68+
};
69+
70+
button.OnPressed += _ => onClick();
71+
button.AddChild(label);
72+
73+
return button;
74+
}
75+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<controls:FancyWindow
2+
xmlns="https://spacestation14.io"
3+
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
4+
Title="{Loc 'pinpointer-ui-title'}"
5+
MinSize="350 300"
6+
Resizable="True">
7+
8+
<BoxContainer Orientation="Vertical" VerticalExpand="True">
9+
<BoxContainer Orientation="Horizontal">
10+
<Label Text="{Loc 'pinpointer-ui-item-to-track'}"
11+
Name="LabelTrack"
12+
HorizontalExpand="True"
13+
Access="Public"
14+
Margin="5 0 0 0"/>
15+
<Button Name="DNASearch"
16+
StyleClasses="OpenBoth"
17+
SetWidth="130"
18+
Text="{Loc 'pinpointer-ui-uplink-search-by-dna'}"
19+
Margin="0 0 5 0"/>
20+
</BoxContainer>
21+
<PanelContainer StyleClasses="HighDivider"/>
22+
23+
<ScrollContainer VerticalExpand="True" HScrollEnabled="False">
24+
<BoxContainer Name="ItemList" Orientation="Vertical"/>
25+
</ScrollContainer>
26+
<LineEdit Name="SearchBar" PlaceHolder="{Loc 'object-tab-object-search'}" HorizontalExpand="true"/>
27+
</BoxContainer>
28+
29+
</controls:FancyWindow>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
2+
3+
using System.Numerics;
4+
using Content.Client.UserInterface.Controls;
5+
using Content.Shared.SS220.Pinpointer;
6+
using Robust.Client.AutoGenerated;
7+
using Robust.Client.UserInterface.Controls;
8+
using Robust.Client.UserInterface.XAML;
9+
10+
namespace Content.Client.SS220.Pinpointer.UI;
11+
12+
[GenerateTypedNameReferences]
13+
public sealed partial class PinpointerUplinkMenu : FancyWindow
14+
{
15+
public FancyWindow? DnaWindow;
16+
17+
public HashSet<TrackedItem> ItemListSet = [];
18+
19+
public Action<NetEntity>? OnTargetPicked;
20+
public Action<string>? OnDnaPicked;
21+
22+
private string _searchText = string.Empty;
23+
24+
public PinpointerUplinkMenu()
25+
{
26+
RobustXamlLoader.Load(this);
27+
SearchBar.OnTextChanged += OnSearchChanged;
28+
DNASearch.OnPressed += OnDNASearch;
29+
}
30+
31+
private void OnSearchChanged(LineEdit.LineEditEventArgs args)
32+
{
33+
_searchText = args.Text.Trim().ToLower();
34+
PopulateList();
35+
}
36+
37+
private void OnDNASearch(BaseButton.ButtonEventArgs args)
38+
{
39+
if (DnaWindow != null)
40+
{
41+
DnaWindow.Open();
42+
return;
43+
}
44+
45+
DnaWindow = new FancyWindow
46+
{
47+
Title = Loc.GetString("pinpointer-ui-uplink-search-by-dna"),
48+
SetSize = new Vector2(200, 200),
49+
};
50+
51+
52+
var boxContainer = new BoxContainer
53+
{
54+
Orientation = BoxContainer.LayoutOrientation.Vertical,
55+
HorizontalAlignment = HAlignment.Center,
56+
VerticalAlignment = VAlignment.Center,
57+
};
58+
59+
var lineEdit = new LineEdit
60+
{
61+
PlaceHolder = Loc.GetString("pinpointer-ui-uplink-enter-dna"),
62+
SetSize = new Vector2(150, 30),
63+
};
64+
65+
var button = new Button()
66+
{
67+
Text = Loc.GetString("pinpointer-ui-uplink-accept"),
68+
Modulate = Color.LimeGreen,
69+
StyleClasses = { "OpenBoth" },
70+
SetSize = new Vector2(150, 30),
71+
};
72+
73+
button.OnPressed += _ =>
74+
{
75+
if (string.IsNullOrEmpty(lineEdit.Text))
76+
return;
77+
78+
OnDnaPicked?.Invoke(lineEdit.Text);
79+
};
80+
81+
boxContainer.AddChild(lineEdit);
82+
boxContainer.AddChild(button);
83+
DnaWindow.AddChild(boxContainer);
84+
DnaWindow.OpenCentered();
85+
}
86+
87+
public void PopulateList()
88+
{
89+
ItemList.RemoveAllChildren();
90+
91+
foreach (var entry in ItemListSet)
92+
{
93+
var button = CreateTargetButton(entry.Name, () => OnTargetPicked?.Invoke(entry.Entity));
94+
95+
if (button == null)
96+
continue;
97+
98+
ItemList.AddChild(button);
99+
}
100+
}
101+
102+
private Button? CreateTargetButton(string fullName, Action onClick)
103+
{
104+
if (!fullName.Contains(_searchText, StringComparison.CurrentCultureIgnoreCase))
105+
return null;
106+
107+
var button = new Button
108+
{
109+
ToolTip = fullName,
110+
StyleClasses = { "OpenBoth" },
111+
SetHeight = 30,
112+
Margin = new Thickness(5, 0, 5, 5),
113+
HorizontalExpand = true,
114+
};
115+
116+
var label = new Label
117+
{
118+
Text = fullName,
119+
HorizontalExpand = true,
120+
HorizontalAlignment = HAlignment.Center,
121+
};
122+
123+
button.OnPressed += _ => onClick();
124+
button.AddChild(label);
125+
126+
return button;
127+
}
128+
}
129+

Content.Server/Implants/ImplanterSystem.cs

+20
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Content.Shared.Interaction;
1010
using Content.Shared.Mindshield.Components;
1111
using Content.Shared.Popups;
12+
using Content.Shared.SS220.MindSlave;
1213
using Content.Shared.Tag; // SS220-mindslave
1314
using Robust.Shared.Containers;
1415
using Robust.Shared.Prototypes;
@@ -30,6 +31,10 @@ public sealed partial class ImplanterSystem : SharedImplanterSystem
3031
private const string MindShieldImplantTag = "MindShield";
3132
private const float MindShieldRemoveTime = 40;
3233
//SS220-mindslave end
34+
// SS220-fakeMS fix begin
35+
[ValidatePrototypeId<EntityPrototype>]
36+
private const string FakeMindShieldImplant = "FakeMindShieldImplant";
37+
// SS220-fakeMS fix end
3338

3439
public override void Initialize()
3540
{
@@ -83,6 +88,21 @@ private void OnImplanterAfterInteract(EntityUid uid, ImplanterComponent componen
8388
}
8489
//SS220-mindslave end
8590

91+
// SS220-fakeMSfix begin
92+
if (component.Implant == FakeMindShieldImplant)
93+
{
94+
if (HasComp<MindShieldComponent>(target))
95+
{
96+
_popup.PopupEntity(Loc.GetString("mindslave-target-mindshielded"), args.User);
97+
return;
98+
}
99+
if (_mindslave.IsEnslaved(target))
100+
{
101+
_popup.PopupEntity(Loc.GetString("mindshield-target-mindslaved"), target, args.User);
102+
return;
103+
}
104+
}
105+
// SS220-fakeMSfix end
86106
//TODO: Rework when surgery is in for implant cases
87107
if (component.CurrentMode == ImplanterToggleMode.Draw && !component.ImplantOnly)
88108
{

0 commit comments

Comments
 (0)