Красивое УИ телепорта для призрака (#378)
* add: nice ghost teleport ui * fix: fix unused import * wtf * fuck you, search bar * fix-add: finally
This commit is contained in:
@@ -48,9 +48,9 @@ public sealed partial class AccessLevelControl : GridContainer
|
|||||||
"ButtonColorSecurityDepartment",
|
"ButtonColorSecurityDepartment",
|
||||||
"ButtonColorMedicalDepartment",
|
"ButtonColorMedicalDepartment",
|
||||||
"ButtonColorEngineeringDepartment",
|
"ButtonColorEngineeringDepartment",
|
||||||
"ButtonColorResearchingDepartment",
|
"ButtonColorScienceDepartment",
|
||||||
"ButtonColorCargoDepartment",
|
"ButtonColorCargoDepartment",
|
||||||
"ButtonColorServiceDepartment"
|
"ButtonColorCivilianDepartment"
|
||||||
};
|
};
|
||||||
var currentColorIndex = 0;
|
var currentColorIndex = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -148,9 +148,7 @@ namespace Content.Client.Ghost
|
|||||||
private void OnGhostWarpsResponse(GhostWarpsResponseEvent msg)
|
private void OnGhostWarpsResponse(GhostWarpsResponseEvent msg)
|
||||||
{
|
{
|
||||||
if (!IsGhost)
|
if (!IsGhost)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
GhostWarpsResponse?.Invoke(msg);
|
GhostWarpsResponse?.Invoke(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,8 +165,11 @@ namespace Content.Client.Stylesheets
|
|||||||
public static readonly Color ButtonColorMedical = Color.FromHex("#4494C8");
|
public static readonly Color ButtonColorMedical = Color.FromHex("#4494C8");
|
||||||
public static readonly Color ButtonColorEngineering = Color.FromHex("#FDA55E");
|
public static readonly Color ButtonColorEngineering = Color.FromHex("#FDA55E");
|
||||||
public static readonly Color ButtonColorCargo = Color.FromHex("#9E6A34");
|
public static readonly Color ButtonColorCargo = Color.FromHex("#9E6A34");
|
||||||
public static readonly Color ButtonColorResearching = Color.FromHex("#984EB4");
|
public static readonly Color ButtonColorScience = Color.FromHex("#984EB4");
|
||||||
public static readonly Color ButtonColorService = Color.FromHex("#40A166");
|
public static readonly Color ButtonColorCivilian = Color.FromHex("#40A166");
|
||||||
|
public static readonly Color ButtonColorJustice = Color.FromHex("#8E3D3D");
|
||||||
|
public static readonly Color ButtonColorSpecific = Color.FromHex("#969696");
|
||||||
|
public static readonly Color ButtonColorAntagonist = Color.FromHex("#7F4141");
|
||||||
|
|
||||||
public override Stylesheet Stylesheet { get; }
|
public override Stylesheet Stylesheet { get; }
|
||||||
|
|
||||||
@@ -1383,14 +1386,14 @@ namespace Content.Client.Stylesheets
|
|||||||
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
|
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
|
||||||
new[]
|
new[]
|
||||||
{
|
{
|
||||||
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorService),
|
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorCivilian),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new StyleRule(
|
new StyleRule(
|
||||||
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
|
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
|
||||||
new[]
|
new[]
|
||||||
{
|
{
|
||||||
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorResearching),
|
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorScience),
|
||||||
}),
|
}),
|
||||||
new StyleRule(
|
new StyleRule(
|
||||||
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
|
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
|
||||||
@@ -1398,6 +1401,24 @@ namespace Content.Client.Stylesheets
|
|||||||
{
|
{
|
||||||
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorCargo),
|
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorCargo),
|
||||||
}),
|
}),
|
||||||
|
new StyleRule(
|
||||||
|
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
|
||||||
|
new[]
|
||||||
|
{
|
||||||
|
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorJustice),
|
||||||
|
}),
|
||||||
|
new StyleRule(
|
||||||
|
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
|
||||||
|
new[]
|
||||||
|
{
|
||||||
|
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorSpecific),
|
||||||
|
}),
|
||||||
|
new StyleRule(
|
||||||
|
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
|
||||||
|
new[]
|
||||||
|
{
|
||||||
|
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorAntagonist),
|
||||||
|
}),
|
||||||
|
|
||||||
|
|
||||||
// NanoHeading
|
// NanoHeading
|
||||||
@@ -1657,20 +1678,35 @@ namespace Content.Client.Stylesheets
|
|||||||
Element<Button>().Class("ButtonColorEngineeringDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
|
Element<Button>().Class("ButtonColorEngineeringDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
|
||||||
.Prop(Control.StylePropertyModulateSelf, ButtonColorEngineering),
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorEngineering),
|
||||||
|
|
||||||
Element<Button>().Class("ButtonColorResearchingDepartment")
|
Element<Button>().Class("ButtonColorScienceDepartment")
|
||||||
.Prop(Control.StylePropertyModulateSelf, ButtonColorResearching),
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorScience),
|
||||||
Element<Button>().Class("ButtonColorResearchingDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
|
Element<Button>().Class("ButtonColorScienceDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
|
||||||
.Prop(Control.StylePropertyModulateSelf, ButtonColorResearching),
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorScience),
|
||||||
|
|
||||||
Element<Button>().Class("ButtonColorServiceDepartment")
|
Element<Button>().Class("ButtonColorCivilianDepartment")
|
||||||
.Prop(Control.StylePropertyModulateSelf, ButtonColorService),
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorCivilian),
|
||||||
Element<Button>().Class("ButtonColorServiceDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
|
Element<Button>().Class("ButtonColorCivilianDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
|
||||||
.Prop(Control.StylePropertyModulateSelf, ButtonColorService),
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorCivilian),
|
||||||
|
|
||||||
Element<Button>().Class("ButtonColorCargoDepartment")
|
Element<Button>().Class("ButtonColorCargoDepartment")
|
||||||
.Prop(Control.StylePropertyModulateSelf, ButtonColorCargo),
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorCargo),
|
||||||
Element<Button>().Class("ButtonColorCargoDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
|
Element<Button>().Class("ButtonColorCargoDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
|
||||||
.Prop(Control.StylePropertyModulateSelf, ButtonColorCargo),
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorCargo),
|
||||||
|
|
||||||
|
Element<Button>().Class("ButtonColorJusticeDepartment")
|
||||||
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorJustice),
|
||||||
|
Element<Button>().Class("ButtonColorJusticeDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
|
||||||
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorJustice),
|
||||||
|
|
||||||
|
Element<Button>().Class("ButtonColorSpecificDepartment")
|
||||||
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorSpecific),
|
||||||
|
Element<Button>().Class("ButtonColorSpecificDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
|
||||||
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorSpecific),
|
||||||
|
|
||||||
|
Element<Button>().Class("ButtonColorAntagonistDepartment")
|
||||||
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorAntagonist),
|
||||||
|
Element<Button>().Class("ButtonColorAntagonistDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
|
||||||
|
.Prop(Control.StylePropertyModulateSelf, ButtonColorAntagonist),
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
// Green Button ---
|
// Green Button ---
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
<DefaultWindow xmlns="https://spacestation14.io" Title="{Loc 'ghost-target-window-title'}" MinSize="450 450" SetSize="450 450">
|
<DefaultWindow xmlns="https://spacestation14.io" Title="{Loc 'ghost-target-window-title'}" MinSize="950 550" SetSize="950 550">
|
||||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio="0.4">
|
<BoxContainer Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio="0.4">
|
||||||
<Button Name="GhostnadoButton" Text="{Loc 'ghost-target-window-warp-to-most-followed'}" HorizontalAlignment="Center" Margin="0 4" />
|
|
||||||
<LineEdit Name="SearchBar" PlaceHolder="Search" HorizontalExpand="True" Margin="0 4" />
|
|
||||||
<ScrollContainer VerticalExpand="True" HorizontalExpand="True" HScrollEnabled="False">
|
<ScrollContainer VerticalExpand="True" HorizontalExpand="True" HScrollEnabled="False">
|
||||||
<BoxContainer Name="ButtonContainer" Orientation="Vertical" VerticalExpand="True" SeparationOverride="5">
|
<BoxContainer Name="GhostTeleportContainter" Orientation="Vertical">
|
||||||
<!-- Target buttons get added here by code -->
|
<!-- Target buttons get added here by code -->
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
</ScrollContainer>
|
</ScrollContainer>
|
||||||
|
|||||||
@@ -1,95 +1,346 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using Content.Shared._White.Antag;
|
||||||
using Content.Shared.Ghost;
|
using Content.Shared.Ghost;
|
||||||
|
using Content.Shared.Roles;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Client.UserInterface.Systems.Ghost.Controls
|
namespace Content.Client.UserInterface.Systems.Ghost.Controls
|
||||||
{
|
{
|
||||||
[GenerateTypedNameReferences]
|
[GenerateTypedNameReferences]
|
||||||
public sealed partial class GhostTargetWindow : DefaultWindow
|
public sealed partial class GhostTargetWindow : DefaultWindow
|
||||||
{
|
{
|
||||||
private List<(string, NetEntity)> _warps = new();
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
private string _searchText = string.Empty;
|
|
||||||
|
private List<GhostWarpPlayer> _playerWarps = new();
|
||||||
|
private List<GhostWarpPlace> _placeWarps = new();
|
||||||
|
private List<GhostWarpGlobalAntagonist> _globalAntoginists = new();
|
||||||
|
|
||||||
|
private List<GhostWarpPlayer> _alivePlayers = new();
|
||||||
|
private List<GhostWarpPlayer> _leftPlayers = new();
|
||||||
|
private List<GhostWarpPlayer> _deadPlayers = new();
|
||||||
|
private List<GhostWarpPlayer> _ghostPlayers = new();
|
||||||
|
|
||||||
public event Action<NetEntity>? WarpClicked;
|
public event Action<NetEntity>? WarpClicked;
|
||||||
public event Action? OnGhostnadoClicked;
|
|
||||||
|
|
||||||
public GhostTargetWindow()
|
public GhostTargetWindow()
|
||||||
{
|
{
|
||||||
|
IoCManager.InjectDependencies(this);
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
SearchBar.OnTextChanged += OnSearchTextChanged;
|
|
||||||
|
|
||||||
GhostnadoButton.OnPressed += _ => OnGhostnadoClicked?.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateWarps(IEnumerable<GhostWarp> warps)
|
|
||||||
{
|
|
||||||
// Server COULD send these sorted but how about we just use the client to do it instead
|
|
||||||
_warps = warps
|
|
||||||
.OrderBy(w => w.IsWarpPoint)
|
|
||||||
.ThenBy(w => w.DisplayName, Comparer<string>.Create(
|
|
||||||
(x, y) => string.Compare(x, y, StringComparison.Ordinal)))
|
|
||||||
.Select(w =>
|
|
||||||
{
|
|
||||||
var name = w.IsWarpPoint
|
|
||||||
? Loc.GetString("ghost-target-window-current-button", ("name", w.DisplayName))
|
|
||||||
: w.DisplayName;
|
|
||||||
|
|
||||||
return (name, w.Entity);
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Populate()
|
public void Populate()
|
||||||
{
|
{
|
||||||
ButtonContainer.DisposeAllChildren();
|
GhostTeleportContainter.DisposeAllChildren();
|
||||||
|
_playerWarps = GetSortedPlayers(_playerWarps);
|
||||||
|
_placeWarps = GetSortedPlaces(_placeWarps);
|
||||||
|
_globalAntoginists = GetSortedAntagonists(_globalAntoginists);
|
||||||
|
|
||||||
|
PlayersAllocation();
|
||||||
AddButtons();
|
AddButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateWarps(List<GhostWarpPlayer> players, List<GhostWarpPlace> places, List<GhostWarpGlobalAntagonist> antagonists)
|
||||||
|
{
|
||||||
|
_playerWarps = players;
|
||||||
|
_placeWarps = places;
|
||||||
|
_globalAntoginists = antagonists;
|
||||||
|
}
|
||||||
|
|
||||||
private void AddButtons()
|
private void AddButtons()
|
||||||
{
|
{
|
||||||
foreach (var (name, warpTarget) in _warps)
|
AddAntagButtons(_globalAntoginists, "ghost-teleport-menu-antagonists-label", "ButtonColorAntagonistDepartment");
|
||||||
|
AddPlayerButtons(_alivePlayers, "ghost-teleport-menu-alive-label", string.Empty, true); // Alive
|
||||||
|
AddPlayerButtons(_deadPlayers, "ghost-teleport-menu-dead-label", string.Empty, true); // Dead
|
||||||
|
AddPlayerButtons(_ghostPlayers, "ghost-teleport-menu-ghosts-label", string.Empty, true); // Ghost
|
||||||
|
AddPlayerButtons(_leftPlayers, "ghost-teleport-menu-left-label", string.Empty, true); // Left
|
||||||
|
AddPlaceButtons(_placeWarps, "ghost-teleport-menu-locations-label", "ButtonColorSpecificDepartment");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddPlayerButtons(List<GhostWarpPlayer> players, string text, string styleClass,
|
||||||
|
bool enableByDepartmentColorSheet)
|
||||||
|
{
|
||||||
|
if (players.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var bigGrid = new GridContainer();
|
||||||
|
|
||||||
|
var bigLabel = new Label
|
||||||
{
|
{
|
||||||
var currentButtonRef = new Button
|
Text = Loc.GetString(text),
|
||||||
|
StyleClasses = { "LabelBig" }
|
||||||
|
};
|
||||||
|
bigGrid.AddChild(bigLabel);
|
||||||
|
|
||||||
|
var sortedPlayers = SortPlayersByDepartment(players);
|
||||||
|
|
||||||
|
foreach (var departmentList in sortedPlayers)
|
||||||
|
{
|
||||||
|
if (departmentList.Count == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var departmentGrid = new GridContainer
|
||||||
{
|
{
|
||||||
Text = name,
|
Columns = 5
|
||||||
|
};
|
||||||
|
|
||||||
|
if (enableByDepartmentColorSheet)
|
||||||
|
styleClass = _prototypeManager.Index<DepartmentPrototype>(departmentList[0].DepartmentID).ButtonStyle;
|
||||||
|
|
||||||
|
var labelText = _prototypeManager.Index<DepartmentPrototype>(departmentList[0].DepartmentID).Name;
|
||||||
|
|
||||||
|
var departmentLabel = new Label
|
||||||
|
{
|
||||||
|
Text = Loc.GetString(labelText) + ": " + departmentList.Count,
|
||||||
|
StyleClasses = { "LabelSecondaryColor" }
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var player in departmentList)
|
||||||
|
{
|
||||||
|
var playerButton = new Button
|
||||||
|
{
|
||||||
|
Text = player.Name,
|
||||||
|
TextAlign = Label.AlignMode.Right,
|
||||||
|
HorizontalAlignment = HAlignment.Center,
|
||||||
|
VerticalAlignment = VAlignment.Center,
|
||||||
|
SizeFlagsStretchRatio = 1,
|
||||||
|
StyleClasses = { styleClass },
|
||||||
|
ToolTip = player.JobName,
|
||||||
|
TooltipDelay = 0.1f,
|
||||||
|
SetWidth = 180,
|
||||||
|
};
|
||||||
|
|
||||||
|
playerButton.OnPressed += _ => WarpClicked?.Invoke(player.Entity);
|
||||||
|
|
||||||
|
departmentGrid.AddChild(playerButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
bigGrid.AddChild(departmentLabel);
|
||||||
|
bigGrid.AddChild(departmentGrid);
|
||||||
|
}
|
||||||
|
|
||||||
|
GhostTeleportContainter.AddChild(bigGrid);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddPlaceButtons(List<GhostWarpPlace> places, string text, string styleClass)
|
||||||
|
{
|
||||||
|
if (places.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var bigGrid = new GridContainer();
|
||||||
|
|
||||||
|
var bigLabel = new Label
|
||||||
|
{
|
||||||
|
Text = Loc.GetString(text),
|
||||||
|
StyleClasses = { "LabelBig" }
|
||||||
|
};
|
||||||
|
bigGrid.AddChild(bigLabel);
|
||||||
|
|
||||||
|
var placesGrid = new GridContainer
|
||||||
|
{
|
||||||
|
Columns = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
var countLabel = new Label
|
||||||
|
{
|
||||||
|
Text = Loc.GetString("ghost-teleport-menu-count-label") + ": " + places.Count,
|
||||||
|
StyleClasses = { "LabelSecondaryColor" }
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var place in places)
|
||||||
|
{
|
||||||
|
var placeButton = new Button
|
||||||
|
{
|
||||||
|
Text = place.Name,
|
||||||
TextAlign = Label.AlignMode.Right,
|
TextAlign = Label.AlignMode.Right,
|
||||||
HorizontalAlignment = HAlignment.Center,
|
HorizontalAlignment = HAlignment.Center,
|
||||||
VerticalAlignment = VAlignment.Center,
|
VerticalAlignment = VAlignment.Center,
|
||||||
SizeFlagsStretchRatio = 1,
|
SizeFlagsStretchRatio = 1,
|
||||||
MinSize = new Vector2(340, 20),
|
StyleClasses = { styleClass },
|
||||||
ClipText = true,
|
ToolTip = place.Description,
|
||||||
|
TooltipDelay = 0.1f,
|
||||||
|
SetWidth = 180,
|
||||||
};
|
};
|
||||||
|
|
||||||
currentButtonRef.OnPressed += _ => WarpClicked?.Invoke(warpTarget);
|
placeButton.OnPressed += _ => WarpClicked?.Invoke(place.Entity);
|
||||||
currentButtonRef.Visible = ButtonIsVisible(currentButtonRef);
|
|
||||||
|
|
||||||
ButtonContainer.AddChild(currentButtonRef);
|
placesGrid.AddChild(placeButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bigGrid.AddChild(countLabel);
|
||||||
|
bigGrid.AddChild(placesGrid);
|
||||||
|
|
||||||
|
GhostTeleportContainter.AddChild(bigGrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ButtonIsVisible(Button button)
|
private void AddAntagButtons(List<GhostWarpGlobalAntagonist> antags, string text, string styleClass)
|
||||||
{
|
{
|
||||||
return string.IsNullOrEmpty(_searchText) || button.Text == null || button.Text.Contains(_searchText, StringComparison.OrdinalIgnoreCase);
|
if (antags.Count == 0)
|
||||||
}
|
return;
|
||||||
|
|
||||||
private void UpdateVisibleButtons()
|
var bigGrid = new GridContainer();
|
||||||
{
|
|
||||||
foreach (var child in ButtonContainer.Children)
|
var bigLabel = new Label
|
||||||
{
|
{
|
||||||
if (child is Button button)
|
Text = Loc.GetString(text),
|
||||||
button.Visible = ButtonIsVisible(button);
|
StyleClasses = { "LabelBig" }
|
||||||
|
};
|
||||||
|
bigGrid.AddChild(bigLabel);
|
||||||
|
|
||||||
|
var sortedAntags = SortAntagsByWeight(antags);
|
||||||
|
|
||||||
|
foreach (var antagList in sortedAntags)
|
||||||
|
{
|
||||||
|
if (antagList.Count == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var departmentGrid = new GridContainer
|
||||||
|
{
|
||||||
|
Columns = 5
|
||||||
|
};
|
||||||
|
|
||||||
|
var labelText = "ghost-teleport-menu-count-label";
|
||||||
|
|
||||||
|
foreach (var antag in antagList)
|
||||||
|
{
|
||||||
|
var playerButton = new Button
|
||||||
|
{
|
||||||
|
Text = antag.Name,
|
||||||
|
TextAlign = Label.AlignMode.Right,
|
||||||
|
HorizontalAlignment = HAlignment.Center,
|
||||||
|
VerticalAlignment = VAlignment.Center,
|
||||||
|
SizeFlagsStretchRatio = 1,
|
||||||
|
StyleClasses = { styleClass },
|
||||||
|
ToolTip = Loc.GetString(antag.AntagonistDescription),
|
||||||
|
TooltipDelay = 0.1f,
|
||||||
|
SetWidth = 180,
|
||||||
|
};
|
||||||
|
|
||||||
|
playerButton.OnPressed += _ => WarpClicked?.Invoke(antag.Entity);
|
||||||
|
|
||||||
|
departmentGrid.AddChild(playerButton);
|
||||||
|
|
||||||
|
labelText = antag.AntagonistName;
|
||||||
|
}
|
||||||
|
|
||||||
|
var departmentLabel = new Label
|
||||||
|
{
|
||||||
|
Text = Loc.GetString(labelText) + ": " + antagList.Count,
|
||||||
|
StyleClasses = { "LabelSecondaryColor" }
|
||||||
|
};
|
||||||
|
|
||||||
|
bigGrid.AddChild(departmentLabel);
|
||||||
|
bigGrid.AddChild(departmentGrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GhostTeleportContainter.AddChild(bigGrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSearchTextChanged(LineEdit.LineEditEventArgs args)
|
public List<List<GhostWarpPlayer>> SortPlayersByDepartment(List<GhostWarpPlayer> players)
|
||||||
{
|
{
|
||||||
_searchText = args.Text;
|
var sortedPlayers = new List<List<GhostWarpPlayer>>();
|
||||||
|
|
||||||
UpdateVisibleButtons();
|
players = players.OrderBy(p => _prototypeManager.Index<DepartmentPrototype>(p.DepartmentID).Weight).ToList();
|
||||||
|
|
||||||
|
var currentList = new List<GhostWarpPlayer>();
|
||||||
|
var currentWeight = _prototypeManager.Index<DepartmentPrototype>(players[0].DepartmentID).Weight;
|
||||||
|
|
||||||
|
foreach (var player in players)
|
||||||
|
{
|
||||||
|
var weight = _prototypeManager.Index<DepartmentPrototype>(player.DepartmentID).Weight;
|
||||||
|
|
||||||
|
if (weight == currentWeight)
|
||||||
|
{
|
||||||
|
currentList.Add(player);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sortedPlayers.Add(currentList);
|
||||||
|
currentList = new List<GhostWarpPlayer> { player };
|
||||||
|
currentWeight = weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sortedPlayers.Contains(currentList))
|
||||||
|
sortedPlayers.Add(currentList);
|
||||||
|
|
||||||
|
sortedPlayers.Reverse();
|
||||||
|
return sortedPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<List<GhostWarpGlobalAntagonist>> SortAntagsByWeight(List<GhostWarpGlobalAntagonist> antagonists)
|
||||||
|
{
|
||||||
|
var sortedAntags = new List<List<GhostWarpGlobalAntagonist>>();
|
||||||
|
|
||||||
|
antagonists = antagonists.OrderBy(a => _prototypeManager.Index<AntagonistPrototype>(a.PrototypeID).Weight).ToList();
|
||||||
|
|
||||||
|
var currentList = new List<GhostWarpGlobalAntagonist>();
|
||||||
|
var currentWeight = _prototypeManager.Index<AntagonistPrototype>(antagonists[0].PrototypeID).Weight;
|
||||||
|
|
||||||
|
foreach (var antagonist in antagonists)
|
||||||
|
{
|
||||||
|
var weight = _prototypeManager.Index<AntagonistPrototype>(antagonist.PrototypeID).Weight;
|
||||||
|
|
||||||
|
if (weight == currentWeight)
|
||||||
|
{
|
||||||
|
currentList.Add(antagonist);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sortedAntags.Add(currentList);
|
||||||
|
currentList = new List<GhostWarpGlobalAntagonist> { antagonist };
|
||||||
|
currentWeight = weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sortedAntags.Contains(currentList))
|
||||||
|
sortedAntags.Add(currentList);
|
||||||
|
|
||||||
|
return sortedAntags;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<GhostWarpPlace> GetSortedPlaces(List<GhostWarpPlace> places)
|
||||||
|
{
|
||||||
|
return places
|
||||||
|
.OrderBy(w => w.Name)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<GhostWarpPlayer> GetSortedPlayers(List<GhostWarpPlayer> players)
|
||||||
|
{
|
||||||
|
return players
|
||||||
|
.OrderBy(w => w.Name)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<GhostWarpGlobalAntagonist> GetSortedAntagonists(List<GhostWarpGlobalAntagonist> antagonists)
|
||||||
|
{
|
||||||
|
return antagonists
|
||||||
|
.OrderBy(w => w.Name)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlayersAllocation()
|
||||||
|
{
|
||||||
|
_alivePlayers.Clear();
|
||||||
|
_deadPlayers.Clear();
|
||||||
|
_leftPlayers.Clear();
|
||||||
|
_ghostPlayers.Clear();
|
||||||
|
|
||||||
|
foreach (var warp in _playerWarps)
|
||||||
|
{
|
||||||
|
if (warp.IsDead)
|
||||||
|
_deadPlayers.Add(warp);
|
||||||
|
else if (warp.IsLeft)
|
||||||
|
_leftPlayers.Add(warp);
|
||||||
|
else if (warp.IsAlive)
|
||||||
|
_alivePlayers.Add(warp);
|
||||||
|
else if (warp.IsGhost)
|
||||||
|
_ghostPlayers.Add(warp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Content.Client.Gameplay;
|
using Content.Client.Ghost;
|
||||||
using Content.Client.Ghost;
|
|
||||||
using Content.Client.UserInterface.Systems.Gameplay;
|
using Content.Client.UserInterface.Systems.Gameplay;
|
||||||
using Content.Client.UserInterface.Systems.Ghost.Widgets;
|
using Content.Client.UserInterface.Systems.Ghost.Widgets;
|
||||||
|
using Content.Shared._White.MagGloves;
|
||||||
using Content.Shared.Ghost;
|
using Content.Shared.Ghost;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controllers;
|
using Robust.Client.UserInterface.Controllers;
|
||||||
@@ -59,9 +59,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
|
|||||||
public void UpdateGui()
|
public void UpdateGui()
|
||||||
{
|
{
|
||||||
if (Gui == null)
|
if (Gui == null)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Gui.Visible = _system?.IsGhost ?? false;
|
Gui.Visible = _system?.IsGhost ?? false;
|
||||||
Gui.Update(_system?.AvailableGhostRoleCount, _system?.Player?.CanReturnToBody);
|
Gui.Update(_system?.AvailableGhostRoleCount, _system?.Player?.CanReturnToBody);
|
||||||
@@ -96,7 +94,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
|
|||||||
if (Gui?.TargetWindow is not { } window)
|
if (Gui?.TargetWindow is not { } window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
window.UpdateWarps(msg.Warps);
|
window.UpdateWarps(msg.Players, msg.Places, msg.Antagonists);
|
||||||
window.Populate();
|
window.Populate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ using Robust.Shared.Random;
|
|||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.StationEvents.Components;
|
using Content.Server.StationEvents.Components;
|
||||||
|
using Content.Shared._White.Antag;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
|
|
||||||
@@ -731,6 +732,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
|
|||||||
{
|
{
|
||||||
_metaData.SetEntityName(mob, name);
|
_metaData.SetEntityName(mob, name);
|
||||||
EnsureComp<NukeOperativeComponent>(mob);
|
EnsureComp<NukeOperativeComponent>(mob);
|
||||||
|
EnsureComp<GlobalAntagonistComponent>(mob).AntagonistPrototype = "globalAntagonistNukeops";
|
||||||
|
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
_humanoid.LoadProfile(mob, profile);
|
_humanoid.LoadProfile(mob, profile);
|
||||||
|
|||||||
@@ -27,12 +27,16 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Content.Shared._White;
|
using Content.Shared._White;
|
||||||
|
using Content.Shared._White.Antag;
|
||||||
|
using Content.Shared.Humanoid;
|
||||||
|
using Content.Shared.Roles;
|
||||||
|
using Content.Shared.SSDIndicator;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Map;
|
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Systems;
|
using Robust.Shared.Physics.Systems;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using InvisibilityComponent = Content.Shared._White.Administration.InvisibilityComponent;
|
using InvisibilityComponent = Content.Shared._White.Administration.InvisibilityComponent;
|
||||||
|
|
||||||
@@ -56,19 +60,12 @@ namespace Content.Server.Ghost
|
|||||||
[Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
|
[Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
|
||||||
[Dependency] private readonly IChatManager _chatManager = default!;
|
[Dependency] private readonly IChatManager _chatManager = default!;
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
|
||||||
|
|
||||||
private EntityQuery<GhostComponent> _ghostQuery;
|
|
||||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_ghostQuery = GetEntityQuery<GhostComponent>();
|
|
||||||
_physicsQuery = GetEntityQuery<PhysicsComponent>();
|
|
||||||
|
|
||||||
SubscribeLocalEvent<GhostComponent, ComponentStartup>(OnGhostStartup);
|
SubscribeLocalEvent<GhostComponent, ComponentStartup>(OnGhostStartup);
|
||||||
SubscribeLocalEvent<GhostComponent, MapInitEvent>(OnMapInit);
|
SubscribeLocalEvent<GhostComponent, MapInitEvent>(OnMapInit);
|
||||||
SubscribeLocalEvent<GhostComponent, ComponentShutdown>(OnGhostShutdown);
|
SubscribeLocalEvent<GhostComponent, ComponentShutdown>(OnGhostShutdown);
|
||||||
@@ -84,7 +81,6 @@ namespace Content.Server.Ghost
|
|||||||
SubscribeNetworkEvent<GhostWarpsRequestEvent>(OnGhostWarpsRequest);
|
SubscribeNetworkEvent<GhostWarpsRequestEvent>(OnGhostWarpsRequest);
|
||||||
SubscribeNetworkEvent<GhostReturnToBodyRequest>(OnGhostReturnToBodyRequest);
|
SubscribeNetworkEvent<GhostReturnToBodyRequest>(OnGhostReturnToBodyRequest);
|
||||||
SubscribeNetworkEvent<GhostWarpToTargetRequestEvent>(OnGhostWarpToTargetRequest);
|
SubscribeNetworkEvent<GhostWarpToTargetRequestEvent>(OnGhostWarpToTargetRequest);
|
||||||
SubscribeNetworkEvent<GhostnadoRequestEvent>(OnGhostnadoRequest);
|
|
||||||
|
|
||||||
SubscribeNetworkEvent<GhostReturnToRoundRequest>(OnGhostReturnToRoundRequest);
|
SubscribeNetworkEvent<GhostReturnToRoundRequest>(OnGhostReturnToRoundRequest);
|
||||||
|
|
||||||
@@ -329,7 +325,7 @@ namespace Content.Server.Ghost
|
|||||||
private void OnGhostReturnToBodyRequest(GhostReturnToBodyRequest msg, EntitySessionEventArgs args)
|
private void OnGhostReturnToBodyRequest(GhostReturnToBodyRequest msg, EntitySessionEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.SenderSession.AttachedEntity is not {Valid: true} attached
|
if (args.SenderSession.AttachedEntity is not {Valid: true} attached
|
||||||
|| !_ghostQuery.TryComp(attached, out var ghost)
|
|| !TryComp(attached, out GhostComponent? ghost)
|
||||||
|| !ghost.CanReturnToBody
|
|| !ghost.CanReturnToBody
|
||||||
|| !TryComp(attached, out ActorComponent? actor))
|
|| !TryComp(attached, out ActorComponent? actor))
|
||||||
{
|
{
|
||||||
@@ -345,20 +341,20 @@ namespace Content.Server.Ghost
|
|||||||
private void OnGhostWarpsRequest(GhostWarpsRequestEvent msg, EntitySessionEventArgs args)
|
private void OnGhostWarpsRequest(GhostWarpsRequestEvent msg, EntitySessionEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.SenderSession.AttachedEntity is not {Valid: true} entity
|
if (args.SenderSession.AttachedEntity is not {Valid: true} entity
|
||||||
|| !_ghostQuery.HasComp(entity))
|
|| !HasComp<GhostComponent>(entity))
|
||||||
{
|
{
|
||||||
Log.Warning($"User {args.SenderSession.Name} sent a {nameof(GhostWarpsRequestEvent)} without being a ghost.");
|
Log.Warning($"User {args.SenderSession.Name} sent a {nameof(GhostWarpsRequestEvent)} without being a ghost.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var response = new GhostWarpsResponseEvent(GetPlayerWarps(entity).Concat(GetLocationWarps()).ToList());
|
var response = new GhostWarpsResponseEvent(GetPlayerWarps(), GetLocationWarps(), GetAntagonistWarps());
|
||||||
RaiseNetworkEvent(response, args.SenderSession.Channel);
|
RaiseNetworkEvent(response, args.SenderSession.Channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGhostWarpToTargetRequest(GhostWarpToTargetRequestEvent msg, EntitySessionEventArgs args)
|
private void OnGhostWarpToTargetRequest(GhostWarpToTargetRequestEvent msg, EntitySessionEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.SenderSession.AttachedEntity is not {Valid: true} attached
|
if (args.SenderSession.AttachedEntity is not {Valid: true} attached
|
||||||
|| !_ghostQuery.HasComp(attached))
|
|| !TryComp(attached, out GhostComponent? _))
|
||||||
{
|
{
|
||||||
Log.Warning($"User {args.SenderSession.Name} tried to warp to {msg.Target} without being a ghost.");
|
Log.Warning($"User {args.SenderSession.Name} tried to warp to {msg.Target} without being a ghost.");
|
||||||
return;
|
return;
|
||||||
@@ -372,66 +368,98 @@ namespace Content.Server.Ghost
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WarpTo(attached, target);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnGhostnadoRequest(GhostnadoRequestEvent msg, EntitySessionEventArgs args)
|
|
||||||
{
|
|
||||||
if (args.SenderSession.AttachedEntity is not {} uid
|
|
||||||
|| !_ghostQuery.HasComp(uid))
|
|
||||||
{
|
|
||||||
Log.Warning($"User {args.SenderSession.Name} tried to ghostnado without being a ghost.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_followerSystem.GetMostFollowed() is not {} target)
|
|
||||||
return;
|
|
||||||
|
|
||||||
WarpTo(uid, target);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WarpTo(EntityUid uid, EntityUid target)
|
|
||||||
{
|
|
||||||
if ((TryComp(target, out WarpPointComponent? warp) && warp.Follow) || HasComp<MobStateComponent>(target))
|
if ((TryComp(target, out WarpPointComponent? warp) && warp.Follow) || HasComp<MobStateComponent>(target))
|
||||||
{
|
{
|
||||||
_followerSystem.StartFollowingEntity(uid, target);
|
_followerSystem.StartFollowingEntity(attached, target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var xform = Transform(uid);
|
var xform = Transform(attached);
|
||||||
_transformSystem.SetCoordinates(uid, xform, Transform(target).Coordinates);
|
_transformSystem.SetCoordinates(attached, xform, Transform(target).Coordinates);
|
||||||
_transformSystem.AttachToGridOrMap(uid, xform);
|
_transformSystem.AttachToGridOrMap(attached, xform);
|
||||||
if (_physicsQuery.TryComp(uid, out var physics))
|
if (TryComp(attached, out PhysicsComponent? physics))
|
||||||
_physics.SetLinearVelocity(uid, Vector2.Zero, body: physics);
|
_physics.SetLinearVelocity(attached, Vector2.Zero, body: physics);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<GhostWarp> GetLocationWarps()
|
private List<GhostWarpPlace> GetLocationWarps()
|
||||||
{
|
{
|
||||||
|
var warps = new List<GhostWarpPlace> { };
|
||||||
var allQuery = AllEntityQuery<WarpPointComponent>();
|
var allQuery = AllEntityQuery<WarpPointComponent>();
|
||||||
|
|
||||||
while (allQuery.MoveNext(out var uid, out var warp))
|
while (allQuery.MoveNext(out var uid, out var warp))
|
||||||
{
|
{
|
||||||
yield return new GhostWarp(GetNetEntity(uid), warp.Location ?? Name(uid), true);
|
var newWarp = new GhostWarpPlace(GetNetEntity(uid), warp.Location ?? Name(uid), warp.Location ?? Description(uid));
|
||||||
|
warps.Add(newWarp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return warps;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<GhostWarp> GetPlayerWarps(EntityUid except)
|
private List<GhostWarpPlayer> GetPlayerWarps()
|
||||||
{
|
{
|
||||||
foreach (var player in _playerManager.Sessions)
|
var warps = new List<GhostWarpPlayer> { };
|
||||||
|
|
||||||
|
foreach (var mindContainer in EntityQuery<MindContainerComponent>())
|
||||||
{
|
{
|
||||||
if (player.AttachedEntity is not {Valid: true} attached)
|
var entity = mindContainer.Owner;
|
||||||
|
|
||||||
|
if (!(HasComp<HumanoidAppearanceComponent>(entity) || HasComp<GhostComponent>(entity)) || HasComp<GlobalAntagonistComponent>(entity))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (attached == except) continue;
|
var playerDepartmentId = _prototypeManager.Index<DepartmentPrototype>("Specific").ID;
|
||||||
|
var playerJobName = "Неизвестно";
|
||||||
|
|
||||||
TryComp<MindContainerComponent>(attached, out var mind);
|
if (_jobs.MindTryGetJob(mindContainer.Mind ?? mindContainer.LastMindStored, out _, out var jobPrototype))
|
||||||
|
{
|
||||||
|
playerJobName = Loc.GetString(jobPrototype.Name);
|
||||||
|
|
||||||
var jobName = _jobs.MindTryGetJobName(mind?.Mind);
|
if (_jobs.TryGetDepartment(jobPrototype.ID, out var departmentPrototype))
|
||||||
var playerInfo = $"{Comp<MetaDataComponent>(attached).EntityName} ({jobName})";
|
{
|
||||||
|
playerDepartmentId = departmentPrototype.ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var hasAnyMind = (mindContainer.Mind ?? mindContainer.LastMindStored) != null;
|
||||||
|
var isDead = _mobState.IsDead(entity);
|
||||||
|
var isLeft = TryComp<SSDIndicatorComponent>(entity, out var indicator) && indicator.IsSSD && !isDead && hasAnyMind;
|
||||||
|
|
||||||
if (_mobState.IsAlive(attached) || _mobState.IsCritical(attached))
|
var warp = new GhostWarpPlayer(
|
||||||
yield return new GhostWarp(GetNetEntity(attached), playerInfo, false);
|
GetNetEntity(entity),
|
||||||
|
Comp<MetaDataComponent>(entity).EntityName,
|
||||||
|
playerJobName,
|
||||||
|
playerDepartmentId,
|
||||||
|
HasComp<GhostComponent>(entity),
|
||||||
|
isLeft,
|
||||||
|
isDead,
|
||||||
|
_mobState.IsAlive(entity)
|
||||||
|
);
|
||||||
|
|
||||||
|
warps.Add(warp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return warps;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<GhostWarpGlobalAntagonist> GetAntagonistWarps()
|
||||||
|
{
|
||||||
|
var warps = new List<GhostWarpGlobalAntagonist> { };
|
||||||
|
|
||||||
|
foreach (var antagonist in EntityQuery<GlobalAntagonistComponent>())
|
||||||
|
{
|
||||||
|
var entity = antagonist.Owner;
|
||||||
|
var prototype = _prototypeManager.Index<AntagonistPrototype>(antagonist.AntagonistPrototype ?? "globalAntagonistUnknown");
|
||||||
|
|
||||||
|
var warp = new GhostWarpGlobalAntagonist(
|
||||||
|
GetNetEntity(entity),
|
||||||
|
Comp<MetaDataComponent>(entity).EntityName,
|
||||||
|
prototype.Name,
|
||||||
|
prototype.Description,
|
||||||
|
prototype.ID
|
||||||
|
);
|
||||||
|
|
||||||
|
warps.Add(warp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return warps;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -474,59 +502,5 @@ namespace Content.Server.Ghost
|
|||||||
|
|
||||||
return ghostBoo.Handled;
|
return ghostBoo.Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityUid? SpawnGhost(Entity<MindComponent?> mind, EntityUid targetEntity,
|
|
||||||
bool canReturn = false)
|
|
||||||
{
|
|
||||||
_transformSystem.TryGetMapOrGridCoordinates(targetEntity, out var spawnPosition);
|
|
||||||
return SpawnGhost(mind, spawnPosition, canReturn);
|
|
||||||
}
|
|
||||||
|
|
||||||
public EntityUid? SpawnGhost(Entity<MindComponent?> mind, EntityCoordinates? spawnPosition = null,
|
|
||||||
bool canReturn = false)
|
|
||||||
{
|
|
||||||
if (!Resolve(mind, ref mind.Comp))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// Test if the map is being deleted
|
|
||||||
var mapUid = spawnPosition?.GetMapUid(EntityManager);
|
|
||||||
if (mapUid == null || TerminatingOrDeleted(mapUid.Value))
|
|
||||||
spawnPosition = null;
|
|
||||||
|
|
||||||
spawnPosition ??= _ticker.GetObserverSpawnPoint();
|
|
||||||
|
|
||||||
if (!spawnPosition.Value.IsValid(EntityManager))
|
|
||||||
{
|
|
||||||
Log.Warning($"No spawn valid ghost spawn position found for {mind.Comp.CharacterName}"
|
|
||||||
+ " \"{ToPrettyString(mind)}\"");
|
|
||||||
_minds.TransferTo(mind.Owner, null, createGhost: false, mind: mind.Comp);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ghost = SpawnAtPosition(GameTicker.ObserverPrototypeName, spawnPosition.Value);
|
|
||||||
var ghostComponent = Comp<GhostComponent>(ghost);
|
|
||||||
|
|
||||||
// Try setting the ghost entity name to either the character name or the player name.
|
|
||||||
// If all else fails, it'll default to the default entity prototype name, "observer".
|
|
||||||
// However, that should rarely happen.
|
|
||||||
if (!string.IsNullOrWhiteSpace(mind.Comp.CharacterName))
|
|
||||||
_metaData.SetEntityName(ghost, mind.Comp.CharacterName);
|
|
||||||
else if (!string.IsNullOrWhiteSpace(mind.Comp.Session?.Name))
|
|
||||||
_metaData.SetEntityName(ghost, mind.Comp.Session.Name);
|
|
||||||
|
|
||||||
if (mind.Comp.TimeOfDeath.HasValue)
|
|
||||||
{
|
|
||||||
SetTimeOfDeath(ghost, mind.Comp.TimeOfDeath!.Value, ghostComponent);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetCanReturnToBody(ghostComponent, canReturn);
|
|
||||||
|
|
||||||
if (canReturn)
|
|
||||||
_minds.Visit(mind.Owner, ghost, mind.Comp);
|
|
||||||
else
|
|
||||||
_minds.TransferTo(mind.Owner, ghost, mind: mind.Comp);
|
|
||||||
Log.Debug($"Spawned ghost \"{ToPrettyString(ghost)}\" for {mind.Comp.CharacterName}.");
|
|
||||||
return ghost;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using Robust.Shared.Audio;
|
|||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Server.Objectives.Components;
|
using Content.Server.Objectives.Components;
|
||||||
|
using Content.Shared._White.Antag;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
|
|
||||||
namespace Content.Server.Ninja.Systems;
|
namespace Content.Server.Ninja.Systems;
|
||||||
@@ -155,6 +156,8 @@ public sealed class SpaceNinjaSystem : SharedSpaceNinjaSystem
|
|||||||
if (config == null)
|
if (config == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
EnsureComp<GlobalAntagonistComponent>(uid).AntagonistPrototype = "globalAntagonistNinja";
|
||||||
|
|
||||||
var role = new NinjaRoleComponent
|
var role = new NinjaRoleComponent
|
||||||
{
|
{
|
||||||
PrototypeId = "SpaceNinja"
|
PrototypeId = "SpaceNinja"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Robust.Server.Maps;
|
|||||||
using Content.Server.GameTicking.Rules.Components;
|
using Content.Server.GameTicking.Rules.Components;
|
||||||
using Content.Server.StationEvents.Components;
|
using Content.Server.StationEvents.Components;
|
||||||
using Content.Server.RoundEnd;
|
using Content.Server.RoundEnd;
|
||||||
|
using Content.Shared._White.Antag;
|
||||||
|
|
||||||
namespace Content.Server.StationEvents.Events;
|
namespace Content.Server.StationEvents.Events;
|
||||||
|
|
||||||
@@ -32,6 +33,9 @@ public sealed class LoneOpsSpawnRule : StationEventSystem<LoneOpsSpawnRuleCompon
|
|||||||
var nukeopsEntity = GameTicker.AddGameRule(component.GameRuleProto);
|
var nukeopsEntity = GameTicker.AddGameRule(component.GameRuleProto);
|
||||||
component.AdditionalRule = nukeopsEntity;
|
component.AdditionalRule = nukeopsEntity;
|
||||||
var nukeopsComp = Comp<NukeopsRuleComponent>(nukeopsEntity);
|
var nukeopsComp = Comp<NukeopsRuleComponent>(nukeopsEntity);
|
||||||
|
|
||||||
|
EnsureComp<GlobalAntagonistComponent>(nukeopsEntity).AntagonistPrototype = "globalAntagonistLoneops";
|
||||||
|
|
||||||
nukeopsComp.SpawnOutpost = false;
|
nukeopsComp.SpawnOutpost = false;
|
||||||
nukeopsComp.RoundEndBehavior = RoundEndBehavior.Nothing;
|
nukeopsComp.RoundEndBehavior = RoundEndBehavior.Nothing;
|
||||||
GameTicker.StartGameRule(nukeopsEntity);
|
GameTicker.StartGameRule(nukeopsEntity);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Content.Server.NPC.Systems;
|
|||||||
using Content.Server.Roles;
|
using Content.Server.Roles;
|
||||||
using Content.Server.Speech.Components;
|
using Content.Server.Speech.Components;
|
||||||
using Content.Server.Temperature.Components;
|
using Content.Server.Temperature.Components;
|
||||||
|
using Content.Shared._White.Antag;
|
||||||
using Content.Shared.CombatMode;
|
using Content.Shared.CombatMode;
|
||||||
using Content.Shared.CombatMode.Pacification;
|
using Content.Shared.CombatMode.Pacification;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
@@ -96,6 +97,7 @@ namespace Content.Server.Zombies
|
|||||||
|
|
||||||
//you're a real zombie now, son.
|
//you're a real zombie now, son.
|
||||||
var zombiecomp = AddComp<ZombieComponent>(target);
|
var zombiecomp = AddComp<ZombieComponent>(target);
|
||||||
|
EnsureComp<GlobalAntagonistComponent>(target).AntagonistPrototype = "globalAntagonistZombie";
|
||||||
|
|
||||||
//we need to basically remove all of these because zombies shouldn't
|
//we need to basically remove all of these because zombies shouldn't
|
||||||
//get diseases, breath, be thirst, be hungry, die in space, have offspring or be paraplegic.
|
//get diseases, breath, be thirst, be hungry, die in space, have offspring or be paraplegic.
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ using Robust.Shared.Configuration;
|
|||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Content.Shared._White;
|
using Content.Shared._White;
|
||||||
|
using Content.Shared._White.Antag;
|
||||||
using Content.Shared._White.Cult.Components;
|
using Content.Shared._White.Cult.Components;
|
||||||
using Content.Shared._White.Cult.Systems;
|
using Content.Shared._White.Cult.Systems;
|
||||||
using Content.Shared._White.Mood;
|
using Content.Shared._White.Mood;
|
||||||
@@ -353,6 +354,7 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
EnsureComp<PentagramComponent>(cultistComponent.Owner);
|
EnsureComp<PentagramComponent>(cultistComponent.Owner);
|
||||||
|
EnsureComp<GlobalAntagonistComponent>(cultistComponent.Owner).AntagonistPrototype = "globalAntagonistCult";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ using System.Linq;
|
|||||||
using Content.Server.Objectives;
|
using Content.Server.Objectives;
|
||||||
using Content.Server.Station.Components;
|
using Content.Server.Station.Components;
|
||||||
using Content.Server.StationEvents.Components;
|
using Content.Server.StationEvents.Components;
|
||||||
|
using Content.Shared._White.Antag;
|
||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
using Content.Shared.NPC.Components;
|
using Content.Shared.NPC.Components;
|
||||||
using Content.Shared.Objectives.Components;
|
using Content.Shared.Objectives.Components;
|
||||||
@@ -285,6 +286,7 @@ public sealed class WizardRuleSystem : GameRuleSystem<WizardRuleComponent>
|
|||||||
bool endRoundOnDeath)
|
bool endRoundOnDeath)
|
||||||
{
|
{
|
||||||
EnsureComp<WizardComponent>(mob).EndRoundOnDeath = endRoundOnDeath;
|
EnsureComp<WizardComponent>(mob).EndRoundOnDeath = endRoundOnDeath;
|
||||||
|
EnsureComp<GlobalAntagonistComponent>(mob).AntagonistPrototype = "globalAntagonistWizard";
|
||||||
|
|
||||||
profile ??= HumanoidCharacterProfile.RandomWithSpecies();
|
profile ??= HumanoidCharacterProfile.RandomWithSpecies();
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
using Content.Shared._White.Antag;
|
||||||
using Content.Shared.Emoting;
|
using Content.Shared.Emoting;
|
||||||
using Content.Shared.Hands;
|
using Content.Shared.Hands;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
|
using Content.Shared.Roles;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Shared.Ghost
|
namespace Content.Shared.Ghost
|
||||||
@@ -62,18 +64,122 @@ namespace Content.Shared.Ghost
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An player body a ghost can warp to.
|
||||||
|
/// This is used as part of <see cref="GhostWarpsResponseEvent"/>
|
||||||
|
/// </summary>
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public struct GhostWarpPlayer
|
||||||
|
{
|
||||||
|
public GhostWarpPlayer(NetEntity entity, string playerName, string playerJobName, string playerDepartmentID, bool isGhost, bool isLeft, bool isDead, bool isAlive)
|
||||||
|
{
|
||||||
|
Entity = entity;
|
||||||
|
Name = playerName;
|
||||||
|
JobName = playerJobName;
|
||||||
|
DepartmentID = playerDepartmentID;
|
||||||
|
|
||||||
|
IsGhost = isGhost;
|
||||||
|
IsLeft = isLeft;
|
||||||
|
IsDead = isDead;
|
||||||
|
IsAlive = isAlive;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The entity representing the warp point.
|
||||||
|
/// This is passed back to the server in <see cref="GhostWarpToTargetRequestEvent"/>
|
||||||
|
/// </summary>
|
||||||
|
public NetEntity Entity { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The display player name to be surfaced in the ghost warps menu
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The display player job to be surfaced in the ghost warps menu
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public string JobName { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The display player department to be surfaced in the ghost warps menu
|
||||||
|
/// </summary>
|
||||||
|
public string DepartmentID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Is player is ghost
|
||||||
|
/// </summary>
|
||||||
|
public bool IsGhost { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Is player body alive
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAlive { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Is player body dead
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDead { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Is player left from body
|
||||||
|
/// </summary>
|
||||||
|
public bool IsLeft { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public struct GhostWarpGlobalAntagonist
|
||||||
|
{
|
||||||
|
public GhostWarpGlobalAntagonist(NetEntity entity, string playerName, string antagonistName, string antagonistDescription, string prototypeID)
|
||||||
|
{
|
||||||
|
Entity = entity;
|
||||||
|
Name = playerName;
|
||||||
|
AntagonistName = antagonistName;
|
||||||
|
AntagonistDescription = antagonistDescription;
|
||||||
|
PrototypeID = prototypeID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The entity representing the warp point.
|
||||||
|
/// This is passed back to the server in <see cref="GhostWarpToTargetRequestEvent"/>
|
||||||
|
/// </summary>
|
||||||
|
public NetEntity Entity { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The display player name to be surfaced in the ghost warps menu
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The display antagonist name to be surfaced in the ghost warps menu
|
||||||
|
/// </summary>
|
||||||
|
public string AntagonistName { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The display antagonist description to be surfaced in the ghost warps menu
|
||||||
|
/// </summary>
|
||||||
|
public string AntagonistDescription { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A antagonist prototype id
|
||||||
|
/// </summary>
|
||||||
|
public string PrototypeID { get; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An individual place a ghost can warp to.
|
/// An individual place a ghost can warp to.
|
||||||
/// This is used as part of <see cref="GhostWarpsResponseEvent"/>
|
/// This is used as part of <see cref="GhostWarpsResponseEvent"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public struct GhostWarp
|
public struct GhostWarpPlace
|
||||||
{
|
{
|
||||||
public GhostWarp(NetEntity entity, string displayName, bool isWarpPoint)
|
public GhostWarpPlace(NetEntity entity, string name, string description)
|
||||||
{
|
{
|
||||||
Entity = entity;
|
Entity = entity;
|
||||||
DisplayName = displayName;
|
Name = name;
|
||||||
IsWarpPoint = isWarpPoint;
|
Description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -85,14 +191,14 @@ namespace Content.Shared.Ghost
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The display name to be surfaced in the ghost warps menu
|
/// The display name to be surfaced in the ghost warps menu
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DisplayName { get; }
|
public string Name { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this warp represents a warp point or a player
|
/// The display name to be surfaced in the ghost warps menu
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsWarpPoint { get; }
|
public string Description { get; }
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A server to client response for a <see cref="GhostWarpsRequestEvent"/>.
|
/// A server to client response for a <see cref="GhostWarpsRequestEvent"/>.
|
||||||
/// Contains players, and locations a ghost can warp to
|
/// Contains players, and locations a ghost can warp to
|
||||||
@@ -100,15 +206,27 @@ namespace Content.Shared.Ghost
|
|||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public sealed class GhostWarpsResponseEvent : EntityEventArgs
|
public sealed class GhostWarpsResponseEvent : EntityEventArgs
|
||||||
{
|
{
|
||||||
public GhostWarpsResponseEvent(List<GhostWarp> warps)
|
public GhostWarpsResponseEvent(List<GhostWarpPlayer> players, List<GhostWarpPlace> places, List<GhostWarpGlobalAntagonist> antagonists)
|
||||||
{
|
{
|
||||||
Warps = warps;
|
Players = players;
|
||||||
|
Places = places;
|
||||||
|
Antagonists = antagonists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A list of players to teleport.
|
||||||
|
/// </summary>
|
||||||
|
public List<GhostWarpPlayer> Players { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of warp points.
|
/// A list of warp points.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<GhostWarp> Warps { get; }
|
public List<GhostWarpPlace> Places { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A list of antagonists to teleport.
|
||||||
|
/// </summary>
|
||||||
|
public List<GhostWarpGlobalAntagonist> Antagonists { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -159,3 +277,4 @@ namespace Content.Shared.Ghost
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ namespace Content.Shared.Mind.Components
|
|||||||
[Access(typeof(SharedMindSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
|
[Access(typeof(SharedMindSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
|
||||||
public EntityUid? Mind { get; set; }
|
public EntityUid? Mind { get; set; }
|
||||||
|
|
||||||
|
[DataField, AutoNetworkedField]
|
||||||
|
[Access(typeof(SharedMindSystem), Other = AccessPermissions.ReadWriteExecute)]
|
||||||
|
public EntityUid? LastMindStored { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True if we have a mind, false otherwise.
|
/// True if we have a mind, false otherwise.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -59,6 +63,7 @@ namespace Content.Shared.Mind.Components
|
|||||||
public MindRemovedMessage(Entity<MindComponent> mind, Entity<MindContainerComponent> container)
|
public MindRemovedMessage(Entity<MindComponent> mind, Entity<MindContainerComponent> container)
|
||||||
: base(mind, container)
|
: base(mind, container)
|
||||||
{
|
{
|
||||||
|
container.Comp.LastMindStored = mind; // Holy shit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,20 +8,25 @@ public sealed partial class DepartmentPrototype : IPrototype
|
|||||||
{
|
{
|
||||||
[IdDataField] public string ID { get; } = default!;
|
[IdDataField] public string ID { get; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A name string.
|
||||||
|
/// </summary>
|
||||||
|
[DataField(required: true)]
|
||||||
|
public string Name = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A description string to display in the character menu as an explanation of the department's function.
|
/// A description string to display in the character menu as an explanation of the department's function.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("description", required: true)]
|
[DataField (required: true)]
|
||||||
public string Description = default!;
|
public string Description = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A color representing this department to use for text.
|
/// A color representing this department to use for text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("color", required: true)]
|
[DataField(required: true)]
|
||||||
public Color Color = default!;
|
public Color Color = default!;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite),
|
[ViewVariables(VVAccess.ReadWrite), DataField(customTypeSerializer: typeof(PrototypeIdListSerializer<JobPrototype>))]
|
||||||
DataField("roles", customTypeSerializer: typeof(PrototypeIdListSerializer<JobPrototype>))]
|
|
||||||
public List<string> Roles = new();
|
public List<string> Roles = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -34,8 +39,14 @@ public sealed partial class DepartmentPrototype : IPrototype
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Departments with a higher weight sorted before other departments in UI.
|
/// Departments with a higher weight sorted before other departments in UI.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("weight")]
|
[DataField]
|
||||||
public int Weight { get; private set; } = 0;
|
public int Weight { get; private set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A style string references to style in StyleNano.cs
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public string ButtonStyle = default!;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
29
Content.Shared/_White/Antag/AntagonistPrototype.cs
Normal file
29
Content.Shared/_White/Antag/AntagonistPrototype.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
|
namespace Content.Shared._White.Antag;
|
||||||
|
|
||||||
|
[Prototype("antagonist")]
|
||||||
|
public sealed partial class AntagonistPrototype : IPrototype
|
||||||
|
{
|
||||||
|
[IdDataField] public string ID { get; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A name string to display in ghost teleport menu .
|
||||||
|
/// </summary>
|
||||||
|
[DataField(required: true)]
|
||||||
|
public string Name = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A description string to display in the character menu as an explanation of the department's function.
|
||||||
|
/// </summary>
|
||||||
|
[DataField(required: true)]
|
||||||
|
public string Description = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A description string to display in the character menu as an explanation of the department's function.
|
||||||
|
/// </summary>
|
||||||
|
[DataField(required: true)]
|
||||||
|
public int Weight = default!;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
11
Content.Shared/_White/Antag/GlobalAntagonistComponent.cs
Normal file
11
Content.Shared/_White/Antag/GlobalAntagonistComponent.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
|
namespace Content.Shared._White.Antag;
|
||||||
|
|
||||||
|
[RegisterComponent, NetworkedComponent]
|
||||||
|
public sealed partial class GlobalAntagonistComponent : Component
|
||||||
|
{
|
||||||
|
[DataField(required: true, customTypeSerializer: typeof(PrototypeIdSerializer<AntagonistPrototype>))]
|
||||||
|
public string? AntagonistPrototype;
|
||||||
|
}
|
||||||
34
Resources/Locale/ru-RU/_white/ui/ghostTeleportMenu.ftl
Normal file
34
Resources/Locale/ru-RU/_white/ui/ghostTeleportMenu.ftl
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
global-antagonist-wizard-name = Волшебник
|
||||||
|
global-antagonist-wizard-description = Старый сумашедший из Федерации Магов, обученный смертельным заклинаниям
|
||||||
|
global-antagonist-nukeops-name = Ядерный оперативник
|
||||||
|
global-antagonist-nukeops-description = Элитный наемник Синдиката
|
||||||
|
global-antagonist-loneops-name = Одинокий оперативник
|
||||||
|
global-antagonist-loneops-description = Элитный наемник Синдиката, один против всей станции
|
||||||
|
global-antagonist-cult-name = Кровавый культист
|
||||||
|
global-antagonist-cult-description = Демонопоклонники, использующие магию крови
|
||||||
|
global-antagonist-ninja-name = Ниндзя
|
||||||
|
global-antagonist-ninja-description = Напичканный высокими технологиями элитный боец
|
||||||
|
global-antagonist-zombie-name = Зомби
|
||||||
|
global-antagonist-zombie-description = Восставший из мертвых под действием вируса
|
||||||
|
global-antagonist-dragon-name = Космический дракон
|
||||||
|
global-antagonist-dragon-description = Дракон! Я видела дракона!!
|
||||||
|
global-antagonist-revenant-name = Мстительный дух
|
||||||
|
global-antagonist-revenant-description = Призрачное существо питающееся жизненной силой
|
||||||
|
global-antagonist-slime-name = Слизень
|
||||||
|
global-antagonist-slime-description = Голодный сгусток чего-то одновременно твердого и жидкого
|
||||||
|
global-antagonist-spider-name = Гигансткий паук
|
||||||
|
global-antagonist-spider-description = Соразмерный с человеком агрессивный паук
|
||||||
|
global-antagonist-spider-clown-name = Гигантский хонк-паук
|
||||||
|
global-antagonist-spider-clown-description = Соразмерный с человеком агрессивный клоун-паук. ХОНК!
|
||||||
|
global-antagonist-rats-name = Гигантская крыса
|
||||||
|
global-antagonist-rats-description = Вечноголодная и агрессивная крыса
|
||||||
|
global-antagonist-unknown-name = Неизвестно
|
||||||
|
global-antagonist-unknown-description = Подозрительно!!
|
||||||
|
|
||||||
|
ghost-teleport-menu-antagonists-label = Антагонисты
|
||||||
|
ghost-teleport-menu-alive-label = Живые
|
||||||
|
ghost-teleport-menu-dead-label = Мертвые
|
||||||
|
ghost-teleport-menu-ghosts-label = Призраки
|
||||||
|
ghost-teleport-menu-left-label = Вышедшие из тела
|
||||||
|
ghost-teleport-menu-locations-label = Локации и объекты
|
||||||
|
ghost-teleport-menu-count-label = Количество
|
||||||
@@ -5,6 +5,6 @@ department-Engineering = Инженерный отдел
|
|||||||
department-Medical = Медицинский отдел
|
department-Medical = Медицинский отдел
|
||||||
department-Security = Служба безопасности
|
department-Security = Служба безопасности
|
||||||
department-Science = Научный отдел
|
department-Science = Научный отдел
|
||||||
department-Specific = Особые для станции
|
department-Specific = Другие
|
||||||
department-Silicon = Киборги
|
department-Silicon = Киборги
|
||||||
department-Justice = Отдел юстиции
|
department-Justice = Отдел юстиции
|
||||||
|
|||||||
@@ -2225,6 +2225,8 @@
|
|||||||
name: ghost-role-information-giant-spider-name
|
name: ghost-role-information-giant-spider-name
|
||||||
description: ghost-role-information-giant-spider-description
|
description: ghost-role-information-giant-spider-description
|
||||||
- type: GhostTakeoverAvailable
|
- type: GhostTakeoverAvailable
|
||||||
|
- type: GlobalAntagonist
|
||||||
|
antagonistPrototype: globalAntagonistSpider
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: angry monkey
|
name: angry monkey
|
||||||
@@ -2285,6 +2287,8 @@
|
|||||||
- type: Bloodstream
|
- type: Bloodstream
|
||||||
bloodMaxVolume: 150
|
bloodMaxVolume: 150
|
||||||
bloodReagent: Laughter
|
bloodReagent: Laughter
|
||||||
|
- type: GlobalAntagonist
|
||||||
|
antagonistPrototype: globalAntagonistSpiderClown
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: possum
|
name: possum
|
||||||
|
|||||||
@@ -121,6 +121,8 @@
|
|||||||
- type: NightVision
|
- type: NightVision
|
||||||
toggleSound: null
|
toggleSound: null
|
||||||
color: "#404040"
|
color: "#404040"
|
||||||
|
- type: GlobalAntagonist
|
||||||
|
antagonistPrototype: globalAntagonistRats
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: MobRatKingBuff
|
id: MobRatKingBuff
|
||||||
@@ -198,7 +200,6 @@
|
|||||||
- map: [ "enum.DamageStateVisualLayers.BaseUnshaded"]
|
- map: [ "enum.DamageStateVisualLayers.BaseUnshaded"]
|
||||||
state: eyes
|
state: eyes
|
||||||
shader: unshaded
|
shader: unshaded
|
||||||
|
|
||||||
- type: SpriteMovement
|
- type: SpriteMovement
|
||||||
movementLayers:
|
movementLayers:
|
||||||
movement:
|
movement:
|
||||||
@@ -291,6 +292,8 @@
|
|||||||
- type: FireVisuals
|
- type: FireVisuals
|
||||||
sprite: Mobs/Effects/onfire.rsi
|
sprite: Mobs/Effects/onfire.rsi
|
||||||
normalState: Mouse_burning
|
normalState: Mouse_burning
|
||||||
|
- type: GlobalAntagonist
|
||||||
|
antagonistPrototype: globalAntagonistRats
|
||||||
|
|
||||||
- type: weightedRandomEntity
|
- type: weightedRandomEntity
|
||||||
id: RatKingLoot
|
id: RatKingLoot
|
||||||
|
|||||||
@@ -93,3 +93,5 @@
|
|||||||
- RevenantTheme
|
- RevenantTheme
|
||||||
- type: Speech
|
- type: Speech
|
||||||
speechVerb: Ghost
|
speechVerb: Ghost
|
||||||
|
- type: GlobalAntagonist
|
||||||
|
antagonistPrototype: globalAntagonistRevenant
|
||||||
|
|||||||
@@ -148,6 +148,8 @@
|
|||||||
- SimpleHostile
|
- SimpleHostile
|
||||||
- type: GhostRole
|
- type: GhostRole
|
||||||
description: ghost-role-information-angry-slimes-description
|
description: ghost-role-information-angry-slimes-description
|
||||||
|
- type: GlobalAntagonist
|
||||||
|
antagonistPrototype: globalAntagonistSlime
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: green slime
|
name: green slime
|
||||||
@@ -183,6 +185,8 @@
|
|||||||
- SimpleHostile
|
- SimpleHostile
|
||||||
- type: GhostRole
|
- type: GhostRole
|
||||||
description: ghost-role-information-angry-slimes-description
|
description: ghost-role-information-angry-slimes-description
|
||||||
|
- type: GlobalAntagonist
|
||||||
|
antagonistPrototype: globalAntagonistSlime
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: yellow slime
|
name: yellow slime
|
||||||
@@ -218,3 +222,5 @@
|
|||||||
- SimpleHostile
|
- SimpleHostile
|
||||||
- type: GhostRole
|
- type: GhostRole
|
||||||
description: ghost-role-information-angry-slimes-description
|
description: ghost-role-information-angry-slimes-description
|
||||||
|
- type: GlobalAntagonist
|
||||||
|
antagonistPrototype: globalAntagonistSlime
|
||||||
|
|||||||
@@ -154,6 +154,8 @@
|
|||||||
- type: GuideHelp
|
- type: GuideHelp
|
||||||
guides:
|
guides:
|
||||||
- MinorAntagonists
|
- MinorAntagonists
|
||||||
|
- type: GlobalAntagonist
|
||||||
|
antagonistPrototype: globalAntagonistDragon
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: BaseMobDragon
|
parent: BaseMobDragon
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
- type: department
|
- type: department
|
||||||
id: Command
|
id: Command
|
||||||
|
name: department-Command
|
||||||
description: department-Command-description
|
description: department-Command-description
|
||||||
color: "#334E6D"
|
color: "#334E6D"
|
||||||
|
weight: 200
|
||||||
roles:
|
roles:
|
||||||
- CentralCommandOfficial
|
- CentralCommandOfficial
|
||||||
- Captain
|
- Captain
|
||||||
@@ -13,13 +15,14 @@
|
|||||||
- Quartermaster
|
- Quartermaster
|
||||||
- Inspector
|
- Inspector
|
||||||
primary: false
|
primary: false
|
||||||
weight: 100
|
buttonStyle: ButtonColorCommandDepartment
|
||||||
|
|
||||||
- type: department
|
- type: department
|
||||||
id: Security
|
id: Security
|
||||||
|
name: department-Security
|
||||||
description: department-Security-description
|
description: department-Security-description
|
||||||
color: "#DE3A3A"
|
color: "#DE3A3A"
|
||||||
weight: 20
|
weight: 180
|
||||||
roles:
|
roles:
|
||||||
- HeadOfSecurity
|
- HeadOfSecurity
|
||||||
- Warden
|
- Warden
|
||||||
@@ -27,21 +30,80 @@
|
|||||||
- SecurityOfficer
|
- SecurityOfficer
|
||||||
- Detective
|
- Detective
|
||||||
- SecurityCadet
|
- SecurityCadet
|
||||||
|
buttonStyle: ButtonColorSecurityDepartment
|
||||||
|
|
||||||
|
- type: department
|
||||||
|
id: Justice
|
||||||
|
name: department-Justice
|
||||||
|
description: department-Justice-description
|
||||||
|
weight: 160
|
||||||
|
color: "#710d00"
|
||||||
|
roles:
|
||||||
|
- Inspector
|
||||||
|
- Lawyer
|
||||||
|
buttonStyle: ButtonColorJusticeDepartment
|
||||||
|
|
||||||
|
- type: department
|
||||||
|
id: Medical
|
||||||
|
name: department-Medical
|
||||||
|
description: department-Medical-description
|
||||||
|
color: "#52B4E9"
|
||||||
|
weight: 140
|
||||||
|
roles:
|
||||||
|
- ChiefMedicalOfficer
|
||||||
|
- SeniorPhysician
|
||||||
|
- MedicalDoctor
|
||||||
|
- Paramedic
|
||||||
|
- Chemist
|
||||||
|
- MedicalIntern
|
||||||
|
- Psychologist
|
||||||
|
buttonStyle: ButtonColorMedicalDepartment
|
||||||
|
|
||||||
|
- type: department
|
||||||
|
id: Engineering
|
||||||
|
name: department-Engineering
|
||||||
|
description: department-Engineering-description
|
||||||
|
color: "#EFB341"
|
||||||
|
weight: 120
|
||||||
|
roles:
|
||||||
|
- ChiefEngineer
|
||||||
|
- SeniorEngineer
|
||||||
|
- AtmosphericTechnician
|
||||||
|
- StationEngineer
|
||||||
|
- TechnicalAssistant
|
||||||
|
buttonStyle: ButtonColorEngineeringDepartment
|
||||||
|
|
||||||
|
- type: department
|
||||||
|
id: Science
|
||||||
|
name: department-Science
|
||||||
|
description: department-Science-description
|
||||||
|
color: "#D381C9"
|
||||||
|
weight: 100
|
||||||
|
roles:
|
||||||
|
- ResearchDirector
|
||||||
|
- SeniorResearcher
|
||||||
|
- Scientist
|
||||||
|
- ResearchAssistant
|
||||||
|
buttonStyle: ButtonColorScienceDepartment
|
||||||
|
|
||||||
- type: department
|
- type: department
|
||||||
id: Cargo
|
id: Cargo
|
||||||
|
name: department-Cargo
|
||||||
description: department-Cargo-description
|
description: department-Cargo-description
|
||||||
color: "#A46106"
|
color: "#A46106"
|
||||||
|
weight: 80
|
||||||
roles:
|
roles:
|
||||||
- Quartermaster
|
- Quartermaster
|
||||||
- CargoTechnician
|
- CargoTechnician
|
||||||
- SalvageSpecialist
|
- SalvageSpecialist
|
||||||
|
buttonStyle: ButtonColorCargoDepartment
|
||||||
|
|
||||||
- type: department
|
- type: department
|
||||||
id: Civilian
|
id: Civilian
|
||||||
|
name: department-Civilian
|
||||||
description: department-Civilian-description
|
description: department-Civilian-description
|
||||||
color: "#9FED58"
|
color: "#9FED58"
|
||||||
weight: -10
|
weight: 60
|
||||||
roles:
|
roles:
|
||||||
- HeadOfPersonnel
|
- HeadOfPersonnel
|
||||||
- Borg
|
- Borg
|
||||||
@@ -60,57 +122,18 @@
|
|||||||
- Visitor
|
- Visitor
|
||||||
- Zookeeper
|
- Zookeeper
|
||||||
- Passenger
|
- Passenger
|
||||||
|
buttonStyle: ButtonColorCivilianDepartment
|
||||||
- type: department
|
|
||||||
id: Engineering
|
|
||||||
description: department-Engineering-description
|
|
||||||
color: "#EFB341"
|
|
||||||
roles:
|
|
||||||
- ChiefEngineer
|
|
||||||
- SeniorEngineer
|
|
||||||
- AtmosphericTechnician
|
|
||||||
- StationEngineer
|
|
||||||
- TechnicalAssistant
|
|
||||||
|
|
||||||
- type: department
|
|
||||||
id: Medical
|
|
||||||
description: department-Medical-description
|
|
||||||
color: "#52B4E9"
|
|
||||||
roles:
|
|
||||||
- ChiefMedicalOfficer
|
|
||||||
- SeniorPhysician
|
|
||||||
- MedicalDoctor
|
|
||||||
- Paramedic
|
|
||||||
- Chemist
|
|
||||||
- MedicalIntern
|
|
||||||
- Psychologist
|
|
||||||
|
|
||||||
- type: department
|
|
||||||
id: Science
|
|
||||||
description: department-Science-description
|
|
||||||
color: "#D381C9"
|
|
||||||
roles:
|
|
||||||
- ResearchDirector
|
|
||||||
- SeniorResearcher
|
|
||||||
- Scientist
|
|
||||||
- ResearchAssistant
|
|
||||||
|
|
||||||
- type: department
|
- type: department
|
||||||
id: Specific
|
id: Specific
|
||||||
|
name: department-Specific
|
||||||
description: department-Specific-description
|
description: department-Specific-description
|
||||||
color: "#9FED58"
|
color: "#9FED58"
|
||||||
weight: 10
|
weight: 0
|
||||||
roles:
|
roles:
|
||||||
- Boxer
|
- Boxer
|
||||||
- Reporter
|
- Reporter
|
||||||
- Zookeeper
|
- Zookeeper
|
||||||
- Psychologist
|
- Psychologist
|
||||||
primary: false
|
primary: false
|
||||||
|
buttonStyle: ButtonColorSpecificDepartment
|
||||||
- type: department
|
|
||||||
id: Justice
|
|
||||||
description: department-Justice-description
|
|
||||||
color: "#710d00"
|
|
||||||
roles:
|
|
||||||
- Inspector
|
|
||||||
- Lawyer
|
|
||||||
|
|||||||
77
Resources/Prototypes/_White/Antag/globalAntagonists.yml
Normal file
77
Resources/Prototypes/_White/Antag/globalAntagonists.yml
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistWizard
|
||||||
|
name: global-antagonist-wizard-name
|
||||||
|
description: global-antagonist-wizard-description
|
||||||
|
weight: 0
|
||||||
|
|
||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistNukeops
|
||||||
|
name: global-antagonist-nukeops-name
|
||||||
|
description: global-antagonist-nukeops-description
|
||||||
|
weight: 1
|
||||||
|
|
||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistLoneops
|
||||||
|
name: global-antagonist-loneops-name
|
||||||
|
description: global-antagonist-loneops-description
|
||||||
|
weight: 2
|
||||||
|
|
||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistCult
|
||||||
|
name: global-antagonist-cult-name
|
||||||
|
description: global-antagonist-cult-description
|
||||||
|
weight: 3
|
||||||
|
|
||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistNinja
|
||||||
|
name: global-antagonist-ninja-name
|
||||||
|
description: global-antagonist-ninja-description
|
||||||
|
weight: 4
|
||||||
|
|
||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistZombie
|
||||||
|
name: global-antagonist-zombie-name
|
||||||
|
description: global-antagonist-zombie-description
|
||||||
|
weight: 5
|
||||||
|
|
||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistDragon
|
||||||
|
name: global-antagonist-dragon-name
|
||||||
|
description: global-antagonist-dragon-description
|
||||||
|
weight: 6
|
||||||
|
|
||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistRevenant
|
||||||
|
name: global-antagonist-revenant-name
|
||||||
|
description: global-antagonist-revenant-description
|
||||||
|
weight: 7
|
||||||
|
|
||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistSlime
|
||||||
|
name: global-antagonist-slime-name
|
||||||
|
description: global-antagonist-slime-description
|
||||||
|
weight: 8
|
||||||
|
|
||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistSpider
|
||||||
|
name: global-antagonist-spider-name
|
||||||
|
description: global-antagonist-spider-description
|
||||||
|
weight: 9
|
||||||
|
|
||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistSpiderClown
|
||||||
|
name: global-antagonist-spider-clown-name
|
||||||
|
description: global-antagonist-spider-clown-description
|
||||||
|
weight: 10
|
||||||
|
|
||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistRats
|
||||||
|
name: global-antagonist-rats-name
|
||||||
|
description: global-antagonist-rats-description
|
||||||
|
weight: 11
|
||||||
|
|
||||||
|
- type: antagonist
|
||||||
|
id: globalAntagonistUnknown
|
||||||
|
name: global-antagonist-unknown-name
|
||||||
|
description: global-antagonist-unknown-description
|
||||||
|
weight: 12
|
||||||
Reference in New Issue
Block a user