Merge remote-tracking branch 'upstream/master' into ups

This commit is contained in:
Jabak
2024-06-26 13:09:06 +03:00
41 changed files with 1376 additions and 282 deletions

View File

@@ -336,7 +336,11 @@ dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter
# ReSharper properties # ReSharper properties
resharper_braces_for_ifelse = required_for_multiline resharper_braces_for_ifelse = required_for_multiline
resharper_csharp_wrap_arguments_style = chop_if_long
resharper_csharp_wrap_parameters_style = chop_if_long
resharper_keep_existing_attribute_arrangement = true resharper_keep_existing_attribute_arrangement = true
resharper_wrap_chained_binary_patterns = chop_if_long
resharper_wrap_chained_method_calls = chop_if_long
[*.{csproj,xml,yml,yaml,dll.config,msbuildproj,targets,props}] [*.{csproj,xml,yml,yaml,dll.config,msbuildproj,targets,props}]
indent_size = 2 indent_size = 2

View File

@@ -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;

View File

@@ -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);
} }

View File

@@ -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 ---

View File

@@ -1,8 +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">
<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>

View File

@@ -1,92 +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 GhostTargetWindow() public GhostTargetWindow()
{ {
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
SearchBar.OnTextChanged += OnSearchTextChanged;
}
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)
{ {
var currentButtonRef = new Button if (players.Count == 0)
return;
var bigGrid = new GridContainer();
var bigLabel = new Label
{ {
Text = name, 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
{
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, 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 = player.JobName,
TooltipDelay = 0.1f,
SetWidth = 180,
}; };
currentButtonRef.OnPressed += _ => WarpClicked?.Invoke(warpTarget); playerButton.OnPressed += _ => WarpClicked?.Invoke(player.Entity);
currentButtonRef.Visible = ButtonIsVisible(currentButtonRef);
ButtonContainer.AddChild(currentButtonRef); departmentGrid.AddChild(playerButton);
}
} }
private bool ButtonIsVisible(Button button) bigGrid.AddChild(departmentLabel);
bigGrid.AddChild(departmentGrid);
}
GhostTeleportContainter.AddChild(bigGrid);
}
private void AddPlaceButtons(List<GhostWarpPlace> places, string text, string styleClass)
{ {
return string.IsNullOrEmpty(_searchText) || button.Text == null || button.Text.Contains(_searchText, StringComparison.OrdinalIgnoreCase); 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,
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
SizeFlagsStretchRatio = 1,
StyleClasses = { styleClass },
ToolTip = place.Description,
TooltipDelay = 0.1f,
SetWidth = 180,
};
placeButton.OnPressed += _ => WarpClicked?.Invoke(place.Entity);
placesGrid.AddChild(placeButton);
} }
private void UpdateVisibleButtons() bigGrid.AddChild(countLabel);
bigGrid.AddChild(placesGrid);
GhostTeleportContainter.AddChild(bigGrid);
}
private void AddAntagButtons(List<GhostWarpGlobalAntagonist> antags, string text, string styleClass)
{ {
foreach (var child in ButtonContainer.Children) if (antags.Count == 0)
return;
var bigGrid = new GridContainer();
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);
}
public List<List<GhostWarpPlayer>> SortPlayersByDepartment(List<GhostWarpPlayer> players)
{
var sortedPlayers = new List<List<GhostWarpPlayer>>();
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;
} }
} }
private void OnSearchTextChanged(LineEdit.LineEditEventArgs args) if (!sortedPlayers.Contains(currentList))
{ sortedPlayers.Add(currentList);
_searchText = args.Text;
UpdateVisibleButtons(); 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);
}
} }
} }
} }

View File

@@ -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();
} }
@@ -122,7 +120,6 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
Gui.TargetWindow.WarpClicked += OnWarpClicked; Gui.TargetWindow.WarpClicked += OnWarpClicked;
Gui.ReturnToRoundPressed += ReturnToRound; Gui.ReturnToRoundPressed += ReturnToRound;
UpdateGui(); UpdateGui();
} }

View File

@@ -1,5 +1,6 @@
#nullable enable #nullable enable
using System.Linq; using System.Linq;
using Content.IntegrationTests.Pair;
using Content.Server.Ghost.Roles; using Content.Server.Ghost.Roles;
using Content.Server.Ghost.Roles.Components; using Content.Server.Ghost.Roles.Components;
using Content.Server.Players; using Content.Server.Players;
@@ -26,7 +27,7 @@ public sealed class GhostRoleTests
"; ";
/// <summary> /// <summary>
/// This is a simple test that just checks if a player can take a ghost roll and then regain control of their /// This is a simple test that just checks if a player can take a ghost role and then regain control of their
/// original entity without encountering errors. /// original entity without encountering errors.
/// </summary> /// </summary>
[Test] [Test]
@@ -34,12 +35,15 @@ public sealed class GhostRoleTests
{ {
await using var pair = await PoolManager.GetServerClient(new PoolSettings await using var pair = await PoolManager.GetServerClient(new PoolSettings
{ {
Dirty = true,
DummyTicker = false, DummyTicker = false,
Connected = true Connected = true
}); });
var server = pair.Server; var server = pair.Server;
var client = pair.Client; var client = pair.Client;
var mapData = await pair.CreateTestMap();
var entMan = server.ResolveDependency<IEntityManager>(); var entMan = server.ResolveDependency<IEntityManager>();
var sPlayerMan = server.ResolveDependency<Robust.Server.Player.IPlayerManager>(); var sPlayerMan = server.ResolveDependency<Robust.Server.Player.IPlayerManager>();
var conHost = client.ResolveDependency<IConsoleHost>(); var conHost = client.ResolveDependency<IConsoleHost>();
@@ -51,7 +55,7 @@ public sealed class GhostRoleTests
EntityUid originalMob = default; EntityUid originalMob = default;
await server.WaitPost(() => await server.WaitPost(() =>
{ {
originalMob = entMan.SpawnEntity(null, MapCoordinates.Nullspace); originalMob = entMan.SpawnEntity(null, mapData.GridCoords);
mindSystem.TransferTo(originalMindId, originalMob, true); mindSystem.TransferTo(originalMindId, originalMob, true);
}); });
@@ -69,12 +73,12 @@ public sealed class GhostRoleTests
Assert.That(entMan.HasComponent<GhostComponent>(ghost)); Assert.That(entMan.HasComponent<GhostComponent>(ghost));
Assert.That(ghost, Is.Not.EqualTo(originalMob)); Assert.That(ghost, Is.Not.EqualTo(originalMob));
Assert.That(session.ContentData()?.Mind, Is.EqualTo(originalMindId)); Assert.That(session.ContentData()?.Mind, Is.EqualTo(originalMindId));
Assert.That(originalMind.OwnedEntity, Is.EqualTo(originalMob)); Assert.That(originalMind.OwnedEntity, Is.EqualTo(originalMob), $"Original mob: {originalMob}, Ghost: {ghost}");
Assert.That(originalMind.VisitingEntity, Is.EqualTo(ghost)); Assert.That(originalMind.VisitingEntity, Is.EqualTo(ghost));
// Spawn ghost takeover entity. // Spawn ghost takeover entity.
EntityUid ghostRole = default; EntityUid ghostRole = default;
await server.WaitPost(() => ghostRole = entMan.SpawnEntity("GhostRoleTestEntity", MapCoordinates.Nullspace)); await server.WaitPost(() => ghostRole = entMan.SpawnEntity("GhostRoleTestEntity", mapData.GridCoords));
// Take the ghost role // Take the ghost role
await server.WaitPost(() => await server.WaitPost(() =>

View File

@@ -0,0 +1,159 @@
using System.Numerics;
using Content.IntegrationTests.Pair;
using Content.Shared.Ghost;
using Content.Shared.Mind;
using Content.Shared.Players;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.UnitTesting;
namespace Content.IntegrationTests.Tests.Minds;
[TestFixture]
public sealed class GhostTests
{
struct GhostTestData
{
public IEntityManager SEntMan;
public Robust.Server.Player.IPlayerManager SPlayerMan;
public Server.Mind.MindSystem SMindSys;
public SharedTransformSystem STransformSys = default!;
public TestPair Pair = default!;
public TestMapData MapData => Pair.TestMap!;
public RobustIntegrationTest.ServerIntegrationInstance Server => Pair.Server;
public RobustIntegrationTest.ClientIntegrationInstance Client => Pair.Client;
/// <summary>
/// Initial player coordinates. Note that this does not necessarily correspond to the position of the
/// <see cref="Player"/> entity.
/// </summary>
public NetCoordinates PlayerCoords = default!;
public NetEntity Player = default!;
public EntityUid SPlayerEnt = default!;
public ICommonSession ClientSession = default!;
public ICommonSession ServerSession = default!;
public GhostTestData()
{
}
}
private async Task<GhostTestData> SetupData()
{
var data = new GhostTestData();
// Client is needed to create a session for the ghost system. Creating a dummy session was too difficult.
data.Pair = await PoolManager.GetServerClient(new PoolSettings
{
DummyTicker = false,
Connected = true,
Dirty = true
});
data.SEntMan = data.Pair.Server.ResolveDependency<IServerEntityManager>();
data.SPlayerMan = data.Pair.Server.ResolveDependency<Robust.Server.Player.IPlayerManager>();
data.SMindSys = data.SEntMan.System<Server.Mind.MindSystem>();
data.STransformSys = data.SEntMan.System<SharedTransformSystem>();
// Setup map.
await data.Pair.CreateTestMap();
data.PlayerCoords = data.SEntMan.GetNetCoordinates(data.MapData.GridCoords.Offset(new Vector2(0.5f, 0.5f)).WithEntityId(data.MapData.MapUid, data.STransformSys, data.SEntMan));
if (data.Client.Session == null)
Assert.Fail("No player");
data.ClientSession = data.Client.Session!;
data.ServerSession = data.SPlayerMan.GetSessionById(data.ClientSession.UserId);
Entity<MindComponent> mind = default!;
await data.Pair.Server.WaitPost(() =>
{
data.Player = data.SEntMan.GetNetEntity(data.SEntMan.SpawnEntity(null, data.SEntMan.GetCoordinates(data.PlayerCoords)));
mind = data.SMindSys.CreateMind(data.ServerSession.UserId, "DummyPlayerEntity");
data.SPlayerEnt = data.SEntMan.GetEntity(data.Player);
data.SMindSys.TransferTo(mind, data.SPlayerEnt, mind: mind.Comp);
data.Server.PlayerMan.SetAttachedEntity(data.ServerSession, data.SPlayerEnt);
});
await data.Pair.RunTicksSync(5);
Assert.Multiple(() =>
{
Assert.That(data.ServerSession.ContentData()?.Mind, Is.EqualTo(mind.Owner));
Assert.That(data.ServerSession.AttachedEntity, Is.EqualTo(data.SPlayerEnt));
Assert.That(data.ServerSession.AttachedEntity, Is.EqualTo(mind.Comp.CurrentEntity),
"Player is not attached to the mind's current entity.");
Assert.That(data.SEntMan.EntityExists(mind.Comp.OwnedEntity),
"The mind's current entity does not exist");
Assert.That(mind.Comp.VisitingEntity == null || data.SEntMan.EntityExists(mind.Comp.VisitingEntity),
"The minds visited entity does not exist.");
});
Assert.That(data.SPlayerEnt, Is.Not.EqualTo(null));
return data;
}
/// <summary>
/// Test that a ghost gets created when the player entity is deleted.
/// 1. Delete mob
/// 2. Assert is ghost
/// </summary>
[Test]
public async Task TestGridGhostOnDelete()
{
var data = await SetupData();
var oldPosition = data.SEntMan.GetComponent<TransformComponent>(data.SPlayerEnt).Coordinates;
Assert.That(!data.SEntMan.HasComponent<GhostComponent>(data.SPlayerEnt), "Player was initially a ghost?");
// Delete entity
await data.Server.WaitPost(() => data.SEntMan.DeleteEntity(data.SPlayerEnt));
await data.Pair.RunTicksSync(5);
var ghost = data.ServerSession.AttachedEntity!.Value;
Assert.That(data.SEntMan.HasComponent<GhostComponent>(ghost), "Player did not become a ghost");
// Ensure the position is the same
var ghostPosition = data.SEntMan.GetComponent<TransformComponent>(ghost).Coordinates;
Assert.That(ghostPosition, Is.EqualTo(oldPosition));
await data.Pair.CleanReturnAsync();
}
/// <summary>
/// Test that a ghost gets created when the player entity is queue deleted.
/// 1. Delete mob
/// 2. Assert is ghost
/// </summary>
[Test]
public async Task TestGridGhostOnQueueDelete()
{
var data = await SetupData();
var oldPosition = data.SEntMan.GetComponent<TransformComponent>(data.SPlayerEnt).Coordinates;
Assert.That(!data.SEntMan.HasComponent<GhostComponent>(data.SPlayerEnt), "Player was initially a ghost?");
// Delete entity
await data.Server.WaitPost(() => data.SEntMan.QueueDeleteEntity(data.SPlayerEnt));
await data.Pair.RunTicksSync(5);
var ghost = data.ServerSession.AttachedEntity!.Value;
Assert.That(data.SEntMan.HasComponent<GhostComponent>(ghost), "Player did not become a ghost");
// Ensure the position is the same
var ghostPosition = data.SEntMan.GetComponent<TransformComponent>(ghost).Coordinates;
Assert.That(ghostPosition, Is.EqualTo(oldPosition));
await data.Pair.CleanReturnAsync();
}
}

View File

@@ -1,3 +1,4 @@
#nullable enable
using System.Linq; using System.Linq;
using Content.Server.GameTicking; using Content.Server.GameTicking;
using Content.Shared.Ghost; using Content.Shared.Ghost;
@@ -77,7 +78,7 @@ public sealed partial class MindTests
await using var pair = await SetupPair(dirty: true); await using var pair = await SetupPair(dirty: true);
var server = pair.Server; var server = pair.Server;
var testMap = await pair.CreateTestMap(); var testMap = await pair.CreateTestMap();
var coordinates = testMap.GridCoords; var testMap2 = await pair.CreateTestMap();
var entMan = server.ResolveDependency<IServerEntityManager>(); var entMan = server.ResolveDependency<IServerEntityManager>();
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
@@ -91,7 +92,7 @@ public sealed partial class MindTests
MindComponent mind = default!; MindComponent mind = default!;
await server.WaitAssertion(() => await server.WaitAssertion(() =>
{ {
playerEnt = entMan.SpawnEntity(null, coordinates); playerEnt = entMan.SpawnEntity(null, testMap.GridCoords);
mindId = player.ContentData()!.Mind!.Value; mindId = player.ContentData()!.Mind!.Value;
mind = entMan.GetComponent<MindComponent>(mindId); mind = entMan.GetComponent<MindComponent>(mindId);
mindSystem.TransferTo(mindId, playerEnt); mindSystem.TransferTo(mindId, playerEnt);
@@ -100,14 +101,20 @@ public sealed partial class MindTests
}); });
await pair.RunTicksSync(5); await pair.RunTicksSync(5);
await server.WaitPost(() => mapManager.DeleteMap(testMap.MapId)); await server.WaitAssertion(() => mapManager.DeleteMap(testMap.MapId));
await pair.RunTicksSync(5); await pair.RunTicksSync(5);
await server.WaitAssertion(() => await server.WaitAssertion(() =>
{ {
#pragma warning disable NUnit2045 // Interdependent assertions. #pragma warning disable NUnit2045 // Interdependent assertions.
Assert.That(entMan.EntityExists(mind.CurrentEntity), Is.True); // Spawn ghost on the second map
Assert.That(mind.CurrentEntity, Is.Not.EqualTo(playerEnt)); var attachedEntity = player.AttachedEntity;
Assert.That(entMan.EntityExists(attachedEntity), Is.True);
Assert.That(attachedEntity, Is.Not.EqualTo(playerEnt));
Assert.That(entMan.HasComponent<GhostComponent>(attachedEntity));
var transform = entMan.GetComponent<TransformComponent>(attachedEntity.Value);
Assert.That(transform.MapID, Is.Not.EqualTo(MapId.Nullspace));
Assert.That(transform.MapID, Is.Not.EqualTo(testMap.MapId));
#pragma warning restore NUnit2045 #pragma warning restore NUnit2045
}); });

View File

@@ -0,0 +1,32 @@
using Content.Shared.Body.Components;
using Content.Shared.Inventory;
using Content.Shared.Popups;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
namespace Content.Server.Destructible.Thresholds.Behaviors;
[UsedImplicitly]
[DataDefinition]
public sealed partial class BurnBodyBehavior : IThresholdBehavior
{
public void Execute(EntityUid bodyId, DestructibleSystem system, EntityUid? cause = null)
{
var transformSystem = system.EntityManager.System<TransformSystem>();
var inventorySystem = system.EntityManager.System<InventorySystem>();
var sharedPopupSystem = system.EntityManager.System<SharedPopupSystem>();
if (system.EntityManager.TryGetComponent<InventoryComponent>(bodyId, out var comp))
{
foreach (var item in inventorySystem.GetHandOrInventoryEntities(bodyId))
{
transformSystem.DropNextTo(item, bodyId);
}
}
sharedPopupSystem.PopupCoordinates(Loc.GetString("bodyburn-text-others", ("name", bodyId)), transformSystem.GetMoverCoordinates(bodyId), PopupType.LargeCaution);
system.EntityManager.QueueDeleteEntity(bodyId);
}
}

View File

@@ -23,7 +23,10 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
public float Offset { get; set; } = 0.5f; public float Offset { get; set; } = 0.5f;
[DataField("transferForensics")] [DataField("transferForensics")]
public bool DoTransferForensics = false; public bool DoTransferForensics;
[DataField]
public bool SpawnInContainer;
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null) public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
{ {
@@ -49,7 +52,9 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.ComponentFactory)) if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.ComponentFactory))
{ {
var spawned = system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector())); var spawned = SpawnInContainer
? system.EntityManager.SpawnNextToOrDrop(entityId, owner)
: system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector()));
system.StackSystem.SetCount(spawned, count); system.StackSystem.SetCount(spawned, count);
TransferForensics(spawned, system, owner); TransferForensics(spawned, system, owner);
@@ -58,7 +63,9 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
{ {
for (var i = 0; i < count; i++) for (var i = 0; i < count; i++)
{ {
var spawned = system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector())); var spawned = SpawnInContainer
? system.EntityManager.SpawnNextToOrDrop(entityId, owner)
: system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector()));
TransferForensics(spawned, system, owner); TransferForensics(spawned, system, owner);
} }

View File

@@ -283,40 +283,18 @@ namespace Content.Server.GameTicking
} }
} }
var xformQuery = GetEntityQuery<TransformComponent>(); var ghost = _ghost.SpawnGhost((mindId, mind), position, canReturn);
var coords = _transform.GetMoverCoordinates(position, xformQuery); if (ghost == null)
return false;
var ghost = Spawn(ObserverPrototypeName, coords);
// 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.CharacterName))
_metaData.SetEntityName(ghost, mind.CharacterName);
else if (!string.IsNullOrWhiteSpace(mind.Session?.Name))
_metaData.SetEntityName(ghost, mind.Session.Name);
var ghostComponent = Comp<GhostComponent>(ghost);
if (mind.TimeOfDeath.HasValue)
{
_ghost.SetTimeOfDeath(ghost, mind.TimeOfDeath!.Value, ghostComponent);
}
if (playerEntity != null) if (playerEntity != null)
_adminLogger.Add(LogType.Mind, $"{EntityManager.ToPrettyString(playerEntity.Value):player} ghosted{(!canReturn ? " (non-returnable)" : "")}"); _adminLogger.Add(LogType.Mind, $"{EntityManager.ToPrettyString(playerEntity.Value):player} ghosted{(!canReturn ? " (non-returnable)" : "")}");
_ghost.SetCanReturnToBody(ghostComponent, canReturn);
if (canReturn)
_mind.Visit(mindId, ghost, mind);
else
_mind.TransferTo(mindId, ghost, mind: mind);
var player = mind.Session; var player = mind.Session;
var userId = player?.UserId; var userId = player?.UserId;
if (userId.HasValue && !_ghostSystem._deathTime.TryGetValue(userId.Value, out _)) if (userId.HasValue && !_ghostSystem._deathTime.TryGetValue(userId.Value, out _))
_ghostSystem._deathTime[userId.Value] = _gameTiming.CurTime; _ghostSystem._deathTime[userId.Value] = _gameTiming.CurTime;
return true; return true;
} }

View File

@@ -9,6 +9,7 @@ using Content.Server.Speech.Components;
using Content.Server.Station.Components; using Content.Server.Station.Components;
using Content.Shared.Chat; using Content.Shared.Chat;
using Content.Shared.Database; using Content.Shared.Database;
using Content.Shared.Mind;
using Content.Shared.Players; using Content.Shared.Players;
using Content.Shared.Mind; using Content.Shared.Mind;
using Content.Shared.Preferences; using Content.Shared.Preferences;
@@ -59,7 +60,9 @@ namespace Content.Server.GameTicking
return spawnableStations; return spawnableStations;
} }
private void SpawnPlayers(List<ICommonSession> readyPlayers, Dictionary<NetUserId, HumanoidCharacterProfile> profiles, bool force) private void SpawnPlayers(List<ICommonSession> readyPlayers,
Dictionary<NetUserId, HumanoidCharacterProfile> profiles,
bool force)
{ {
// Allow game rules to spawn players by themselves if needed. (For example, nuke ops or wizard) // Allow game rules to spawn players by themselves if needed. (For example, nuke ops or wizard)
RaiseLocalEvent(new RulePlayerSpawningEvent(readyPlayers, profiles, force)); RaiseLocalEvent(new RulePlayerSpawningEvent(readyPlayers, profiles, force));
@@ -120,10 +123,17 @@ namespace Content.Server.GameTicking
RefreshLateJoinAllowed(); RefreshLateJoinAllowed();
// Allow rules to add roles to players who have been spawned in. (For example, on-station traitors) // Allow rules to add roles to players who have been spawned in. (For example, on-station traitors)
RaiseLocalEvent(new RulePlayerJobsAssignedEvent(assignedJobs.Keys.Select(x => _playerManager.GetSessionById(x)).ToArray(), profiles, force)); RaiseLocalEvent(new RulePlayerJobsAssignedEvent(
assignedJobs.Keys.Select(x => _playerManager.GetSessionById(x)).ToArray(),
profiles,
force));
} }
private void SpawnPlayer(ICommonSession player, EntityUid station, string? jobId = null, bool lateJoin = true, bool silent = false) private void SpawnPlayer(ICommonSession player,
EntityUid station,
string? jobId = null,
bool lateJoin = true,
bool silent = false)
{ {
var character = GetPlayerProfile(player); var character = GetPlayerProfile(player);
@@ -136,7 +146,12 @@ namespace Content.Server.GameTicking
SpawnPlayer(player, character, station, jobId, lateJoin, silent); SpawnPlayer(player, character, station, jobId, lateJoin, silent);
} }
private void SpawnPlayer(ICommonSession player, HumanoidCharacterProfile character, EntityUid station, string? jobId = null, bool lateJoin = true, bool silent = false) private void SpawnPlayer(ICommonSession player,
HumanoidCharacterProfile character,
EntityUid station,
string? jobId = null,
bool lateJoin = true,
bool silent = false)
{ {
// Can't spawn players with a dummy ticker! // Can't spawn players with a dummy ticker!
if (DummyTicker) if (DummyTicker)
@@ -244,7 +259,9 @@ namespace Content.Server.GameTicking
restrictedRoles.UnionWith(jobBans); restrictedRoles.UnionWith(jobBans);
// Pick best job best on prefs. // Pick best job best on prefs.
jobId ??= _stationJobs.PickBestAvailableJobWithPriority(station, character.JobPriorities, true, jobId ??= _stationJobs.PickBestAvailableJobWithPriority(station,
character.JobPriorities,
true,
restrictedRoles); restrictedRoles);
// If no job available, stay in lobby, or if no lobby spawn as observer // If no job available, stay in lobby, or if no lobby spawn as observer
if (jobId is null) if (jobId is null)
@@ -253,7 +270,9 @@ namespace Content.Server.GameTicking
{ {
JoinAsObserver(player); JoinAsObserver(player);
} }
_chatManager.DispatchServerMessage(player, Loc.GetString("game-ticker-player-no-jobs-available-when-joining"));
_chatManager.DispatchServerMessage(player,
Loc.GetString("game-ticker-player-no-jobs-available-when-joining"));
return; return;
} }
@@ -267,7 +286,7 @@ namespace Content.Server.GameTicking
_mind.SetUserId(newMind, data.UserId); _mind.SetUserId(newMind, data.UserId);
var jobPrototype = _prototypeManager.Index<JobPrototype>(jobId); var jobPrototype = _prototypeManager.Index<JobPrototype>(jobId);
var job = new JobComponent { Prototype = jobId }; var job = new JobComponent {Prototype = jobId};
_roles.MindAddRole(newMind, job, silent: silent); _roles.MindAddRole(newMind, job, silent: silent);
var jobName = _jobs.MindTryGetJobName(newMind); var jobName = _jobs.MindTryGetJobName(newMind);
@@ -311,12 +330,11 @@ namespace Content.Server.GameTicking
if (lateJoin && !silent) if (lateJoin && !silent)
{ {
_chatSystem.DispatchStationAnnouncement(station, _chatSystem.DispatchStationAnnouncement(station,
Loc.GetString( Loc.GetString("latejoin-arrival-announcement",
"latejoin-arrival-announcement",
("character", MetaData(mob).EntityName), ("character", MetaData(mob).EntityName),
("gender", character.Gender), // WD-EDIT ("gender", character.Gender), // WD-EDIT
("job", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(jobName)) ("job", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(jobName))),
), Loc.GetString("latejoin-arrival-sender"), Loc.GetString("latejoin-arrival-sender"),
playDefaultSound: false); playDefaultSound: false);
} }
@@ -328,14 +346,17 @@ namespace Content.Server.GameTicking
_stationJobs.TryAssignJob(station, jobPrototype, player.UserId); _stationJobs.TryAssignJob(station, jobPrototype, player.UserId);
if (lateJoin) if (lateJoin)
_adminLogger.Add(LogType.LateJoin, LogImpact.Medium, $"Player {player.Name} late joined as {character.Name:characterName} on station {Name(station):stationName} with {ToPrettyString(mob):entity} as a {jobName:jobName}."); _adminLogger.Add(LogType.LateJoin,
LogImpact.Medium,
$"Player {player.Name} late joined as {character.Name:characterName} on station {Name(station):stationName} with {ToPrettyString(mob):entity} as a {jobName:jobName}.");
else else
_adminLogger.Add(LogType.RoundStartJoin, LogImpact.Medium, $"Player {player.Name} joined as {character.Name:characterName} on station {Name(station):stationName} with {ToPrettyString(mob):entity} as a {jobName:jobName}."); _adminLogger.Add(LogType.RoundStartJoin,
LogImpact.Medium,
$"Player {player.Name} joined as {character.Name:characterName} on station {Name(station):stationName} with {ToPrettyString(mob):entity} as a {jobName:jobName}.");
// Make sure they're aware of extended access. // Make sure they're aware of extended access.
if (Comp<StationJobsComponent>(station).ExtendedAccess if (Comp<StationJobsComponent>(station).ExtendedAccess
&& (jobPrototype.ExtendedAccess.Count > 0 && (jobPrototype.ExtendedAccess.Count > 0 || jobPrototype.ExtendedAccessGroups.Count > 0))
|| jobPrototype.ExtendedAccessGroups.Count > 0))
{ {
_chatManager.DispatchServerMessage(player, Loc.GetString("job-greet-crew-shortages")); _chatManager.DispatchServerMessage(player, Loc.GetString("job-greet-crew-shortages"));
} }
@@ -357,14 +378,20 @@ namespace Content.Server.GameTicking
} }
else else
{ {
_chatManager.DispatchServerMessage(player, Loc.GetString("latejoin-arrivals-direction-time", _chatManager.DispatchServerMessage(player,
("time", $"{arrival:mm\\:ss}"))); Loc.GetString("latejoin-arrivals-direction-time", ("time", $"{arrival:mm\\:ss}")));
} }
} }
// We raise this event directed to the mob, but also broadcast it so game rules can do something now. // We raise this event directed to the mob, but also broadcast it so game rules can do something now.
PlayersJoinedRoundNormally++; PlayersJoinedRoundNormally++;
var aev = new PlayerSpawnCompleteEvent(mob, player, jobId, lateJoin, PlayersJoinedRoundNormally, station, character); var aev = new PlayerSpawnCompleteEvent(mob,
player,
jobId,
lateJoin,
PlayersJoinedRoundNormally,
station,
character);
RaiseLocalEvent(mob, aev, true); RaiseLocalEvent(mob, aev, true);
} }
@@ -485,32 +512,24 @@ namespace Content.Server.GameTicking
if (DummyTicker) if (DummyTicker)
return; return;
var mind = player.GetMind(); Entity<MindComponent?>? mind = player.GetMind();
if (mind == null) if (mind == null)
{ {
mind = _mind.CreateMind(player.UserId); var name = GetPlayerProfile(player).Name;
var (mindId, mindComp) = _mind.CreateMind(player.UserId, name);
mind = (mindId, mindComp);
_mind.SetUserId(mind.Value, player.UserId); _mind.SetUserId(mind.Value, player.UserId);
_roles.MindAddRole(mind.Value, new ObserverRoleComponent()); _roles.MindAddRole(mind.Value, new ObserverRoleComponent());
} }
var name = GetPlayerProfile(player).Name; var ghost = _ghost.SpawnGhost(mind.Value);
_adminLogger.Add(LogType.LateJoin,
var ghost = SpawnObserverMob(); LogImpact.Low,
_metaData.SetEntityName(ghost, name); $"{player.Name} late joined the round as an Observer with {ToPrettyString(ghost):entity}.");
_ghost.SetCanReturnToBody(ghost, false);
_mind.TransferTo(mind.Value, ghost);
_adminLogger.Add(LogType.LateJoin, LogImpact.Low, $"{player.Name} late joined the round as an Observer with {ToPrettyString(ghost):entity}.");
} }
#region Mob Spawning Helpers
private EntityUid SpawnObserverMob()
{
var coordinates = GetObserverSpawnPoint();
return EntityManager.SpawnEntity(ObserverPrototypeName, coordinates);
}
#endregion
#region Spawn Points #region Spawn Points
public EntityCoordinates GetObserverSpawnPoint() public EntityCoordinates GetObserverSpawnPoint()
{ {
_possiblePositions.Clear(); _possiblePositions.Clear();
@@ -531,8 +550,7 @@ namespace Content.Server.GameTicking
var query = AllEntityQuery<MapGridComponent>(); var query = AllEntityQuery<MapGridComponent>();
while (query.MoveNext(out var uid, out var grid)) while (query.MoveNext(out var uid, out var grid))
{ {
if (!metaQuery.TryGetComponent(uid, out var meta) || if (!metaQuery.TryGetComponent(uid, out var meta) || meta.EntityPaused || TerminatingOrDeleted(uid))
meta.EntityPaused)
{ {
continue; continue;
} }
@@ -553,8 +571,7 @@ namespace Content.Server.GameTicking
{ {
var gridXform = Transform(gridUid); var gridXform = Transform(gridUid);
return new EntityCoordinates(gridUid, return new EntityCoordinates(gridUid, gridXform.InvWorldMatrix.Transform(toMap.Position));
gridXform.InvWorldMatrix.Transform(toMap.Position));
} }
return spawn; return spawn;
@@ -570,8 +587,9 @@ namespace Content.Server.GameTicking
{ {
var mapUid = _mapManager.GetMapEntityId(map); var mapUid = _mapManager.GetMapEntityId(map);
if (!metaQuery.TryGetComponent(mapUid, out var meta) || if (!metaQuery.TryGetComponent(mapUid, out var meta)
meta.EntityPaused) || meta.EntityPaused
|| TerminatingOrDeleted(mapUid))
{ {
continue; continue;
} }
@@ -584,6 +602,7 @@ namespace Content.Server.GameTicking
_sawmill.Warning("Found no observer spawn points!"); _sawmill.Warning("Found no observer spawn points!");
return EntityCoordinates.Invalid; return EntityCoordinates.Invalid;
} }
#endregion #endregion
} }
@@ -601,7 +620,11 @@ namespace Content.Server.GameTicking
public bool LateJoin { get; } public bool LateJoin { get; }
public EntityUid Station { get; } public EntityUid Station { get; }
public PlayerBeforeSpawnEvent(ICommonSession player, HumanoidCharacterProfile profile, string? jobId, bool lateJoin, EntityUid station) public PlayerBeforeSpawnEvent(ICommonSession player,
HumanoidCharacterProfile profile,
string? jobId,
bool lateJoin,
EntityUid station)
{ {
Player = player; Player = player;
Profile = profile; Profile = profile;
@@ -629,7 +652,13 @@ namespace Content.Server.GameTicking
// Ex. If this is the 27th person to join, this will be 27. // Ex. If this is the 27th person to join, this will be 27.
public int JoinOrder { get; } public int JoinOrder { get; }
public PlayerSpawnCompleteEvent(EntityUid mob, ICommonSession player, string? jobId, bool lateJoin, int joinOrder, EntityUid station, HumanoidCharacterProfile profile) public PlayerSpawnCompleteEvent(EntityUid mob,
ICommonSession player,
string? jobId,
bool lateJoin,
int joinOrder,
EntityUid station,
HumanoidCharacterProfile profile)
{ {
Mob = mob; Mob = mob;
Player = player; Player = player;

View File

@@ -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);

View File

@@ -27,11 +27,17 @@ 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.Map;
using Robust.Shared.Network; using Robust.Shared.Network;
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;
@@ -55,11 +61,20 @@ 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 IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly MetaDataSystem _metaData = 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);
@@ -101,8 +116,13 @@ namespace Content.Server.Ghost
{ {
var message = Loc.GetString("ghost-respawn-max-players", ("players", maxPlayers)); var message = Loc.GetString("ghost-respawn-max-players", ("players", maxPlayers));
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message)); var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message));
_chatManager.ChatMessageToOne(Shared.Chat.ChatChannel.Server, message, _chatManager.ChatMessageToOne(Shared.Chat.ChatChannel.Server,
wrappedMessage, default, false, args.SenderSession.ConnectedClient, Color.Red); message,
wrappedMessage,
default,
false,
args.SenderSession.ConnectedClient,
Color.Red);
return; return;
} }
@@ -113,13 +133,18 @@ namespace Content.Server.Ghost
{ {
var message = Loc.GetString("ghost-respawn-bug"); var message = Loc.GetString("ghost-respawn-bug");
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message)); var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message));
_chatManager.ChatMessageToOne(Shared.Chat.ChatChannel.Server, message, _chatManager.ChatMessageToOne(Shared.Chat.ChatChannel.Server,
wrappedMessage, default, false, args.SenderSession.ConnectedClient, Color.Red); message,
wrappedMessage,
default,
false,
args.SenderSession.ConnectedClient,
Color.Red);
_deathTime[userId] = _gameTiming.CurTime; _deathTime[userId] = _gameTiming.CurTime;
return; return;
} }
var timeUntilRespawn = (double)cfg.GetCVar(WhiteCVars.GhostRespawnTime); var timeUntilRespawn = (double) cfg.GetCVar(WhiteCVars.GhostRespawnTime);
var timePast = (_gameTiming.CurTime - deathTime).TotalMinutes; var timePast = (_gameTiming.CurTime - deathTime).TotalMinutes;
if (timePast >= timeUntilRespawn) if (timePast >= timeUntilRespawn)
{ {
@@ -131,20 +156,32 @@ namespace Content.Server.Ghost
ticker.Respawn(targetPlayer); ticker.Respawn(targetPlayer);
_deathTime.Remove(userId); _deathTime.Remove(userId);
_adminLogger.Add(LogType.Mind, LogImpact.Extreme, $"{args.SenderSession.ConnectedClient.UserName} вернулся в лобби посредством гост респавна."); _adminLogger.Add(LogType.Mind,
LogImpact.Extreme,
$"{args.SenderSession.ConnectedClient.UserName} вернулся в лобби посредством гост респавна.");
var message = Loc.GetString("ghost-respawn-window-rules-footer"); var message = Loc.GetString("ghost-respawn-window-rules-footer");
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message)); var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message));
_chatManager.ChatMessageToOne(Shared.Chat.ChatChannel.Server, message, _chatManager.ChatMessageToOne(Shared.Chat.ChatChannel.Server,
wrappedMessage, default, false, args.SenderSession.ConnectedClient, Color.Red); message,
wrappedMessage,
default,
false,
args.SenderSession.ConnectedClient,
Color.Red);
} }
else else
{ {
var message = Loc.GetString("ghost-respawn-time-left", ("time", (int)(timeUntilRespawn-timePast))); var message = Loc.GetString("ghost-respawn-time-left", ("time", (int) (timeUntilRespawn - timePast)));
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message)); var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message));
_chatManager.ChatMessageToOne(Shared.Chat.ChatChannel.Server, message, _chatManager.ChatMessageToOne(Shared.Chat.ChatChannel.Server,
wrappedMessage, default, false, args.SenderSession.ConnectedClient, Color.Red); message,
wrappedMessage,
default,
false,
args.SenderSession.ConnectedClient,
Color.Red);
} }
} }
@@ -318,8 +355,8 @@ 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
|| !TryComp(attached, out GhostComponent? ghost) || !_ghostQuery.TryComp(attached, out var ghost)
|| !ghost.CanReturnToBody || !ghost.CanReturnToBody
|| !TryComp(attached, out ActorComponent? actor)) || !TryComp(attached, out ActorComponent? actor))
{ {
@@ -334,21 +371,22 @@ 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
|| !HasComp<GhostComponent>(entity)) || !_ghostQuery.HasComp(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
|| !TryComp(attached, out GhostComponent? _)) || !_ghostQuery.HasComp(attached))
{ {
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;
@@ -373,40 +411,121 @@ namespace Content.Server.Ghost
_transformSystem.AttachToGridOrMap(attached, xform); _transformSystem.AttachToGridOrMap(attached, xform);
if (TryComp(attached, out PhysicsComponent? physics)) if (TryComp(attached, out PhysicsComponent? physics))
_physics.SetLinearVelocity(attached, Vector2.Zero, body: physics); _physics.SetLinearVelocity(attached, Vector2.Zero, body: physics);
WarpTo(attached, target);
} }
private IEnumerable<GhostWarp> GetLocationWarps() private void WarpTo(EntityUid uid, EntityUid target)
{ {
if ((TryComp(target, out WarpPointComponent? warp) && warp.Follow) || HasComp<MobStateComponent>(target))
{
_followerSystem.StartFollowingEntity(uid, target);
return;
}
var xform = Transform(uid);
_transformSystem.SetCoordinates(uid, xform, Transform(target).Coordinates);
_transformSystem.AttachToGridOrMap(uid, xform);
if (_physicsQuery.TryComp(uid, out var physics))
_physics.SetLinearVelocity(uid, Vector2.Zero, body: physics);
}
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);
} }
private IEnumerable<GhostWarp> GetPlayerWarps(EntityUid except) return warps;
}
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;
if (_mobState.IsAlive(attached) || _mobState.IsCritical(attached))
yield return new GhostWarp(GetNetEntity(attached), playerInfo, false);
} }
} }
var hasAnyMind = (mindContainer.Mind ?? mindContainer.LastMindStored) != null;
var isDead = _mobState.IsDead(entity);
var isLeft = TryComp<SSDIndicatorComponent>(entity, out var indicator) && indicator.IsSSD && !isDead &&
hasAnyMind;
var warp = new GhostWarpPlayer(
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
private void OnEntityStorageInsertAttempt(EntityUid uid, GhostComponent comp, ref InsertIntoEntityStorageAttemptEvent args) private void OnEntityStorageInsertAttempt(EntityUid uid,
GhostComponent comp,
ref InsertIntoEntityStorageAttemptEvent args)
{ {
args.Cancelled = true; args.Cancelled = true;
} }
@@ -433,6 +552,7 @@ namespace Content.Server.Ghost
_visibilitySystem.AddLayer(uid, vis, (int) VisibilityFlags.Ghost, false); _visibilitySystem.AddLayer(uid, vis, (int) VisibilityFlags.Ghost, false);
_visibilitySystem.RemoveLayer(uid, vis, (int) VisibilityFlags.Normal, false); _visibilitySystem.RemoveLayer(uid, vis, (int) VisibilityFlags.Normal, false);
} }
_visibilitySystem.RefreshVisibility(uid, visibilityComponent: vis); _visibilitySystem.RefreshVisibility(uid, visibilityComponent: vis);
} }
} }
@@ -444,5 +564,62 @@ 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;
}
} }
} }

View File

@@ -1,6 +1,7 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Content.Server.Administration.Logs; using Content.Server.Administration.Logs;
using Content.Server.GameTicking; using Content.Server.GameTicking;
using Content.Server.Ghost;
using Content.Server.Mind.Commands; using Content.Server.Mind.Commands;
using Content.Shared.Database; using Content.Shared.Database;
using Content.Shared.Ghost; using Content.Shared.Ghost;
@@ -9,10 +10,8 @@ using Content.Shared.Mind.Components;
using Content.Shared.Players; using Content.Shared.Players;
using Robust.Server.GameStates; using Robust.Server.GameStates;
using Robust.Server.Player; using Robust.Server.Player;
using Robust.Shared.Map.Components;
using Robust.Shared.Network; using Robust.Shared.Network;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Timing;
using Robust.Shared.Utility; using Robust.Shared.Utility;
namespace Content.Server.Mind; namespace Content.Server.Mind;
@@ -22,8 +21,7 @@ public sealed class MindSystem : SharedMindSystem
[Dependency] private readonly GameTicker _gameTicker = default!; [Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly IPlayerManager _players = default!; [Dependency] private readonly IPlayerManager _players = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!; [Dependency] private readonly GhostSystem _ghosts = default!;
[Dependency] private readonly SharedGhostSystem _ghosts = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly PvsOverrideSystem _pvsOverride = default!; [Dependency] private readonly PvsOverrideSystem _pvsOverride = default!;
@@ -63,8 +61,8 @@ public sealed class MindSystem : SharedMindSystem
&& !Terminating(visiting)) && !Terminating(visiting))
{ {
TransferTo(mindId, visiting, mind: mind); TransferTo(mindId, visiting, mind: mind);
if (TryComp(visiting, out GhostComponent? ghost)) if (TryComp(visiting, out GhostComponent? ghostComp))
_ghosts.SetCanReturnToBody(ghost, false); _ghosts.SetCanReturnToBody(ghostComp, false);
return; return;
} }
@@ -74,40 +72,13 @@ public sealed class MindSystem : SharedMindSystem
if (!component.GhostOnShutdown || mind.Session == null || _gameTicker.RunLevel == GameRunLevel.PreRoundLobby) if (!component.GhostOnShutdown || mind.Session == null || _gameTicker.RunLevel == GameRunLevel.PreRoundLobby)
return; return;
var xform = Transform(uid); var ghost = _ghosts.SpawnGhost((mindId, mind), uid);
var gridId = xform.GridUid; if (ghost != null)
var spawnPosition = Transform(uid).Coordinates;
// Use a regular timer here because the entity has probably been deleted.
Timer.Spawn(0, () =>
{
// Make extra sure the round didn't end between spawning the timer and it being executed.
if (_gameTicker.RunLevel == GameRunLevel.PreRoundLobby)
return;
// Async this so that we don't throw if the grid we're on is being deleted.
if (!HasComp<MapGridComponent>(gridId))
spawnPosition = _gameTicker.GetObserverSpawnPoint();
// TODO refactor observer spawning.
// please.
if (!spawnPosition.IsValid(EntityManager))
{
// This should be an error, if it didn't cause tests to start erroring when they delete a player.
Log.Warning($"Entity \"{ToPrettyString(uid)}\" for {mind.CharacterName} was deleted, and no applicable spawn location is available.");
TransferTo(mindId, null, createGhost: false, mind: mind);
return;
}
var ghost = Spawn(GameTicker.ObserverPrototypeName, spawnPosition);
var ghostComponent = Comp<GhostComponent>(ghost);
_ghosts.SetCanReturnToBody(ghostComponent, false);
// Log these to make sure they're not causing the GameTicker round restart bugs... // Log these to make sure they're not causing the GameTicker round restart bugs...
Log.Debug($"Entity \"{ToPrettyString(uid)}\" for {mind.CharacterName} was deleted, spawned \"{ToPrettyString(ghost)}\"."); Log.Debug($"Entity \"{ToPrettyString(uid)}\" for {mind.CharacterName} was deleted, spawned \"{ToPrettyString(ghost)}\".");
_metaData.SetEntityName(ghost, mind.CharacterName ?? string.Empty); else
TransferTo(mindId, ghost, mind: mind); // This should be an error, if it didn't cause tests to start erroring when they delete a player.
}); Log.Warning($"Entity \"{ToPrettyString(uid)}\" for {mind.CharacterName} was deleted, and no applicable spawn location is available.");
} }
public override bool TryGetMind(NetUserId user, [NotNullWhen(true)] out EntityUid? mindId, [NotNullWhen(true)] out MindComponent? mind) public override bool TryGetMind(NetUserId user, [NotNullWhen(true)] out EntityUid? mindId, [NotNullWhen(true)] out MindComponent? mind)

View File

@@ -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"

View File

@@ -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);

View File

@@ -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.

View File

@@ -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";
} }
} }

View File

@@ -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();

View File

@@ -266,6 +266,27 @@ public sealed class FollowerSystem : EntitySystem
StopFollowingEntity(player, uid, followed); StopFollowingEntity(player, uid, followed);
} }
} }
/// <summary>
/// Get the most followed entity.
/// </summary>
public EntityUid? GetMostFollowed()
{
EntityUid? picked = null;
int most = 0;
var query = EntityQueryEnumerator<FollowedComponent>();
while (query.MoveNext(out var uid, out var comp))
{
var count = comp.Following.Count;
if (count > most)
{
picked = uid;
most = count;
}
}
return picked;
}
} }
public abstract class FollowEvent : EntityEventArgs public abstract class FollowEvent : EntityEventArgs

View File

@@ -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>
@@ -125,6 +243,12 @@ namespace Content.Shared.Ghost
} }
} }
/// <summary>
/// A client to server request for their ghost to be warped to the most followed entity.
/// </summary>
[Serializable, NetSerializable]
public sealed class GhostnadoRequestEvent : EntityEventArgs;
/// <summary> /// <summary>
/// A client to server request for their ghost to return to body /// A client to server request for their ghost to return to body
/// </summary> /// </summary>
@@ -153,3 +277,4 @@ namespace Content.Shared.Ghost
{ {
} }
} }

View File

@@ -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
} }
} }

View File

@@ -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>

View 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!;
}

View 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;
}

View File

@@ -4876,3 +4876,60 @@
id: 324 id: 324
time: '2024-06-22T12:55:50.0000000+00:00' time: '2024-06-22T12:55:50.0000000+00:00'
url: https://api.github.com/repos/frosty-dev/ss14-core/pulls/376 url: https://api.github.com/repos/frosty-dev/ss14-core/pulls/376
- author: Aviu
changes:
- message: "\u0422\u0435\u043F\u0435\u0440\u044C \u043C\u043E\u0436\u043D\u043E\
\ \u0441\u0433\u043E\u0440\u0435\u0442\u044C \u0434\u043E \u0442\u043B\u0430\
."
type: Add
- message: "\u0422\u0435\u043F\u0435\u0440\u044C \u043F\u0440\u0438 \u0443\u0434\
\u0430\u043B\u0435\u043D\u0438\u0438 \u0442\u0435\u043B\u0430 \u043F\u0440\u0438\
\u0437\u0440\u0430\u043A \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\
\ \u0441\u043F\u0430\u0432\u043D\u0438\u0442\u0441\u044F."
type: Fix
id: 325
time: '2024-06-25T21:39:44.0000000+00:00'
url: https://api.github.com/repos/frosty-dev/ss14-core/pulls/382
- author: ThereDrD
changes:
- message: "\u0418\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0442\u0435\u043B\
\u0435\u043F\u043E\u0440\u0442\u0430 \u043F\u0440\u0438\u0437\u0440\u0430\u043A\
\u0430 \u043F\u0435\u0440\u0435\u0440\u0430\u0431\u043E\u0442\u0430\u043D \u043F\
\u043E\u0434 \u0441\u0442\u0438\u043B\u044C \u0441\u044113 \u0438 \u0441\u0442\
\u0430\u043B \u0431\u043E\u043B\u0435\u0435 \u0431\u043E\u043B\u0435\u0435 \u0443\
\u0434\u043E\u0431\u043D\u044B\u0439. \u0422\u0435\u043F\u0435\u0440\u044C \u044D\
\u0442\u043E \u043C\u043E\u0436\u043D\u043E \u0441\u0447\u0438\u0442\u0430\u0442\
\u044C \u043F\u043E\u043B\u043D\u043E\u0446\u0435\u043D\u043D\u044B\u043C \u043E\
\u0431\u0437\u043E\u0440\u043E\u043C \u0441\u043E\u0441\u0442\u043E\u044F\u043D\
\u0438\u044F \u0440\u0430\u0443\u043D\u0434\u0430."
type: Add
- message: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0430 \u0421\u043E\u0440\
\u0442\u0438\u0440\u043E\u0432\u043A\u0430 \u043F\u0435\u0440\u0441\u043E\u043D\
\u0430\u0436\u0435\u0439 \u0438 \u0438\u0433\u0440\u043E\u043A\u043E\u0432 \u043F\
\u043E \u0434\u0435\u043F\u0430\u0440\u0442\u0430\u043C\u0435\u043D\u0442\u0430\
\u043C\u0438 \u0438 \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430 \u0441\
\ \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C\u044E \u043F\u0435\u0440\
\u0441\u043E\u043D\u0430\u0436\u0430 \u043F\u0440\u0438 \u043D\u0430\u0432\u0435\
\u0434\u0435\u043D\u0438\u0438 \u043C\u044B\u0448\u043A\u0438 \u043D\u0430 \u0438\
\u043C\u044F."
type: Add
- message: "\u0412 \u043C\u0435\u043D\u044E \u0442\u0435\u043B\u0435\u043F\u043E\
\u0440\u0442\u0430 \u0433\u043E\u0441\u0442\u043E\u0432 \u0442\u0435\u043F\u0435\
\u0440\u044C \u0432\u044B\u0434\u0435\u043B\u044F\u044E\u0442\u0441\u044F \u0433\
\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u044B\u0435 \u0430\u043D\u0442\u0430\
\u0433\u043E\u043D\u0438\u0441\u0442\u044B, \u043D\u0430\u043F\u0440\u0438\u043C\
\u0435\u0440 \u041D\u044E\u043A\u0435\u0440\u044B, \u043F\u0430\u0443\u043A\u0438\
\ \u0438\u043B\u0438 \u041A\u0443\u043B\u044C\u0442, \u043A\u043E\u0433\u0434\
\u0430 \u043F\u043E\u043B\u0443\u0447\u0438\u0442 \u043D\u0438\u043C\u0431\u044B\
."
type: Add
- message: "\u041F\u043E\u0438\u0441\u043A \u0443\u0434\u0430\u043B\u0435\u043D\
\ \u0438\u0437 \u043C\u0435\u043D\u044E \u0442\u0435\u043B\u0435\u043F\u043E\
\u0440\u0442\u0430 \u0432 \u0432\u0438\u0434\u0443 \u043D\u0435\u0432\u0435\u0440\
\u043E\u044F\u0442\u043D\u043E\u0439 \u0437\u0430\u0431\u0430\u0433\u043E\u0432\
\u0430\u043D\u043D\u043E\u0441\u0442\u0438 \u0438\u0437-\u0437\u0430 \u043A\u043E\
\u0434\u0430 \u0434\u0432\u0438\u0436\u043A\u0430."
type: Remove
id: 326
time: '2024-06-26T02:13:42.0000000+00:00'
url: https://api.github.com/repos/frosty-dev/ss14-core/pulls/378

View File

@@ -0,0 +1 @@
bodyburn-text-others = {$name} burns to ash!

View File

@@ -19,6 +19,7 @@ ghost-gui-toggle-hearing-popup-off = You can now only hear radio and nearby mess
ghost-target-window-title = Ghost Warp ghost-target-window-title = Ghost Warp
ghost-target-window-current-button = Warp: {$name} ghost-target-window-current-button = Warp: {$name}
ghost-target-window-warp-to-most-followed = Warp to Most Followed
ghost-roles-window-title = Ghost Roles ghost-roles-window-title = Ghost Roles
ghost-roles-window-request-role-button = Request ghost-roles-window-request-role-button = Request

View 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 = Количество

View File

@@ -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 = Отдел юстиции

View File

@@ -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

View File

@@ -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

View File

@@ -93,3 +93,5 @@
- RevenantTheme - RevenantTheme
- type: Speech - type: Speech
speechVerb: Ghost speechVerb: Ghost
- type: GlobalAntagonist
antagonistPrototype: globalAntagonistRevenant

View File

@@ -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

View File

@@ -154,6 +154,8 @@
- type: GuideHelp - type: GuideHelp
guides: guides:
- MinorAntagonists - MinorAntagonists
- type: GlobalAntagonist
antagonistPrototype: globalAntagonistDragon
- type: entity - type: entity
parent: BaseMobDragon parent: BaseMobDragon

View File

@@ -60,6 +60,21 @@
damage: 400 damage: 400
behaviors: behaviors:
- !type:GibBehavior { } - !type:GibBehavior { }
- trigger:
!type:DamageTypeTrigger
damageType: Heat
damage: 1500
behaviors:
- !type:SpawnEntitiesBehavior
spawnInContainer: true
spawn:
Ash:
min: 1
max: 1
- !type:BurnBodyBehavior { }
- !type:PlaySoundBehavior
sound:
collection: MeatLaserImpact
- type: RadiationReceiver - type: RadiationReceiver
- type: Stamina - type: Stamina
- type: MobState - type: MobState

View File

@@ -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

View 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