Skip to content

Commit

Permalink
Merge branch 'Goob-Station:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidenkrz authored Aug 15, 2024
2 parents b63e949 + 03b6caf commit 6474a33
Show file tree
Hide file tree
Showing 289 changed files with 178,032 additions and 1,280 deletions.
2 changes: 1 addition & 1 deletion Content.Benchmarks/MapLoadBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task Cleanup()
PoolManager.Shutdown();
}

public static readonly string[] MapsSource = { "Empty", "Box", "Bagel", "Dev", "CentComm", "Atlas", "Core", "TestTeg", "Saltern", "Packed", "Omega", "Cluster", "Reach", "Origin", "Meta", "Marathon", "Europa", "MeteorArena", "Fland", "Barratry", "Oasis", "FlandHighPop", "OasisHighPop", "OriginHighPop" };
public static readonly string[] MapsSource = { "Empty", "Box", "Bagel", "Dev", "CentComm", "Atlas", "Core", "TestTeg", "Saltern", "Packed", "Omega", "Cluster", "Reach", "Origin", "Meta", "Marathon", "Europa", "MeteorArena", "Fland", "Barratry", "Oasis", "FlandHighPop", "OasisHighPop", "OriginHighPop", "Cog" };

[ParamsSource(nameof(MapsSource))]
public string Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void SetButtons()
NotesButton.Disabled = !_adminManager.CanCommand("adminnotes");
ShowBansButton.Disabled = !_adminManager.CanCommand("banlist");
WhitelistToggle.Disabled =
!(_adminManager.CanCommand("addwhitelist") && _adminManager.CanCommand("removewhitelist"));
!(_adminManager.CanCommand("whitelistadd") && _adminManager.CanCommand("whitelistremove"));
LogsButton.Disabled = !_adminManager.CanCommand("adminlogs");
RejuvenateButton.Disabled = !_adminManager.HasFlag(AdminFlags.Debug);
DeleteButton.Disabled = !_adminManager.HasFlag(AdminFlags.Debug);
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public static void SetupContexts(IInputContextContainer contexts)
human.AddFunction(ContentKeyFunctions.OpenBackpack);
human.AddFunction(ContentKeyFunctions.OpenBelt);
human.AddFunction(ContentKeyFunctions.MouseMiddle);
human.AddFunction(ContentKeyFunctions.RotateObjectClockwise);
human.AddFunction(ContentKeyFunctions.RotateObjectCounterclockwise);
human.AddFunction(ContentKeyFunctions.FlipObject);
human.AddFunction(ContentKeyFunctions.ArcadeUp);
human.AddFunction(ContentKeyFunctions.ArcadeDown);
human.AddFunction(ContentKeyFunctions.ArcadeLeft);
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ void AddCheckBox(string checkBoxName, bool currentState, Action<BaseButton.Butto
AddButton(ContentKeyFunctions.MovePulledObject);
AddButton(ContentKeyFunctions.ReleasePulledObject);
AddButton(ContentKeyFunctions.Point);
AddButton(ContentKeyFunctions.RotateObjectClockwise);
AddButton(ContentKeyFunctions.RotateObjectCounterclockwise);
AddButton(ContentKeyFunctions.FlipObject);

AddHeader("ui-options-header-ui");
AddButton(ContentKeyFunctions.FocusChat);
Expand Down
1 change: 1 addition & 0 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public sealed class PostMapInitTest
"Reach",
"Train",
"Oasis",
"Cog",
"FlandHighPop", // Goobstation - add highpop maps
"OasisHighPop",
"OriginHighPop"
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Administration/Commands/BanPanelCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public override async void Execute(IConsoleShell shell, string argStr, string[]
{
if (shell.Player is not { } player)
{
shell.WriteError(Loc.GetString("cmd-banpanel-server"));
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Administration/Commands/ControlMob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteLine("shell-server-cannot");
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
5 changes: 2 additions & 3 deletions Content.Server/Administration/Commands/DSay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ sealed class DSay : IConsoleCommand

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player;
if (player == null)
if (shell.Player is not { } player)
{
shell.WriteLine("shell-only-players-can-run-this-command");
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
5 changes: 2 additions & 3 deletions Content.Server/Administration/Commands/FaxUiCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ public sealed class FaxUiCommand : IConsoleCommand

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player;
if (player == null)
if (shell.Player is not { } player)
{
shell.WriteLine("shell-only-players-can-run-this-command");
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
5 changes: 2 additions & 3 deletions Content.Server/Administration/Commands/FollowCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ public sealed class FollowCommand : IConsoleCommand

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player;
if (player == null)
if (shell.Player is not { } player)
{
shell.WriteError(Loc.GetString("shell-only-players-can-run-this-command"));
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteLine("This does not work from the server console.");
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public async void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteError("This does not work from the server console.");
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public async void Execute(IConsoleShell shell, string argStr, string[] args)

if (shell.Player is not { } player)
{
shell.WriteError("This does not work from the server console.");
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Administration/Commands/SetAdminOOC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player == null)
{
shell.WriteError(Loc.GetString("shell-only-players-can-run-this-command"));
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
8 changes: 4 additions & 4 deletions Content.Server/Botany/Systems/MutationSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void MutateSeed(ref SeedData seed, float severity)
}

// Add up everything in the bits column and put the number here.
const int totalbits = 275;
const int totalbits = 262;

#pragma warning disable IDE0055 // disable formatting warnings because this looks more readable
// Tolerances (55)
Expand All @@ -65,10 +65,10 @@ public void MutateSeed(ref SeedData seed, float severity)
// Kill the plant (30)
MutateBool(ref seed.Viable , false, 30, totalbits, severity);

// Fun (90)
// Fun (72)
MutateBool(ref seed.Seedless , true , 10, totalbits, severity);
MutateBool(ref seed.Slip , true , 10, totalbits, severity);
MutateBool(ref seed.Sentient , true , 10, totalbits, severity);
MutateBool(ref seed.Sentient , true , 2 , totalbits, severity);
MutateBool(ref seed.Ligneous , true , 10, totalbits, severity);
MutateBool(ref seed.Bioluminescent, true , 10, totalbits, severity);
MutateBool(ref seed.TurnIntoKudzu , true , 10, totalbits, severity);
Expand Down Expand Up @@ -115,10 +115,10 @@ public SeedData Cross(SeedData a, SeedData b)
CrossFloat(ref result.Production, a.Production);
CrossFloat(ref result.Potency, a.Potency);

// we do not transfer Sentient to another plant to avoid ghost role spam
CrossBool(ref result.Seedless, a.Seedless);
CrossBool(ref result.Viable, a.Viable);
CrossBool(ref result.Slip, a.Slip);
CrossBool(ref result.Sentient, a.Sentient);
CrossBool(ref result.Ligneous, a.Ligneous);
CrossBool(ref result.Bioluminescent, a.Bioluminescent);
CrossBool(ref result.TurnIntoKudzu, a.TurnIntoKudzu);
Expand Down
22 changes: 19 additions & 3 deletions Content.Server/Botany/Systems/PlantHolderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,17 @@ private void OnInteractUsing(Entity<PlantHolderComponent> entity, ref InteractUs
{
healthOverride = component.Health;
}
component.Seed.Unique = false;
var seed = _botany.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates, args.User, healthOverride);
var packetSeed = component.Seed;
if (packetSeed.Sentient)
{
packetSeed = packetSeed.Clone(); // clone before modifying the seed
packetSeed.Sentient = false;
}
else
{
packetSeed.Unique = false;
}
var seed = _botany.SpawnSeedPacket(packetSeed, Transform(args.User).Coordinates, args.User, healthOverride);
_randomHelper.RandomOffset(seed, 0.25f);
var displayName = Loc.GetString(component.Seed.DisplayName);
_popup.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message",
Expand Down Expand Up @@ -626,8 +635,15 @@ public void Update(EntityUid uid, PlantHolderComponent? component = null)
}
else if (component.Age < 0) // Revert back to seed packet!
{
var packetSeed = component.Seed;
if (packetSeed.Sentient)
{
if (!packetSeed.Unique) // clone if necessary before modifying the seed
packetSeed = packetSeed.Clone();
packetSeed.Sentient = false; // remove Sentient to avoid ghost role spam
}
// will put it in the trays hands if it has any, please do not try doing this
_botany.SpawnSeedPacket(component.Seed, Transform(uid).Coordinates, uid);
_botany.SpawnSeedPacket(packetSeed, Transform(uid).Coordinates, uid);
RemovePlant(uid, component);
component.ForceUpdate = true;
Update(uid, component);
Expand Down
11 changes: 9 additions & 2 deletions Content.Server/Botany/Systems/SeedExtractorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,19 @@ private void OnInteractUsing(EntityUid uid, SeedExtractorComponent seedExtractor
var amount = _random.Next(seedExtractor.BaseMinSeeds, seedExtractor.BaseMaxSeeds + 1);
var coords = Transform(uid).Coordinates;

var packetSeed = seed;
if (packetSeed.Sentient)
{
if (!packetSeed.Unique) // clone if necessary before modifying the seed
packetSeed = packetSeed.Clone();
packetSeed.Sentient = false; // remove Sentient to avoid ghost role spam
}
if (amount > 1)
seed.Unique = false;
packetSeed.Unique = false;

for (var i = 0; i < amount; i++)
{
_botanySystem.SpawnSeedPacket(seed, coords, args.User);
_botanySystem.SpawnSeedPacket(packetSeed, coords, args.User);
}
}
}
2 changes: 1 addition & 1 deletion Content.Server/Chat/Commands/LOOCCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteError("This command cannot be run from the server.");
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Chat/Commands/SayCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteError("This command cannot be run from the server.");
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Chat/Commands/SuicideCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteLine(Loc.GetString("shell-cannot-run-command-from-server"));
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Chat/Commands/WhisperCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteError("This command cannot be run from the server.");
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}

Expand Down
34 changes: 32 additions & 2 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,41 @@ public void DispatchGlobalAnnouncement(
_chatManager.ChatMessageToAll(ChatChannel.Radio, message, wrappedMessage, default, false, true, colorOverride);
if (playSound)
{
_audio.PlayGlobal(announcementSound?.GetSound() ?? DefaultAnnouncementSound, Filter.Broadcast(), true, AudioParams.Default.WithVolume(-2f));
_audio.PlayGlobal(announcementSound == null ? DefaultAnnouncementSound : _audio.GetSound(announcementSound), Filter.Broadcast(), true, AudioParams.Default.WithVolume(-2f));
}
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Global station announcement from {sender}: {message}");
}

/// <summary>
/// Dispatches an announcement to players selected by filter.
/// </summary>
/// <param name="filter">Filter to select players who will recieve the announcement</param>
/// <param name="message">The contents of the message</param>
/// <param name="source">The entity making the announcement (used to determine the station)</param>
/// <param name="sender">The sender (Communications Console in Communications Console Announcement)</param>
/// <param name="playDefaultSound">Play the announcement sound</param>
/// <param name="announcementSound">Sound to play</param>
/// <param name="colorOverride">Optional color for the announcement message</param>
public void DispatchFilteredAnnouncement(
Filter filter,
string message,
EntityUid? source = null,
string? sender = null,
bool playSound = true,
SoundSpecifier? announcementSound = null,
Color? colorOverride = null)
{
sender ??= Loc.GetString("chat-manager-sender-announcement");

var wrappedMessage = Loc.GetString("chat-manager-sender-announcement-wrap-message", ("sender", sender), ("message", FormattedMessage.EscapeText(message)));
_chatManager.ChatMessageToManyFiltered(filter, ChatChannel.Radio, message, wrappedMessage, source ?? default, false, true, colorOverride);
if (playSound)
{
_audio.PlayGlobal(announcementSound?.ToString() ?? DefaultAnnouncementSound, filter, true, AudioParams.Default.WithVolume(-2f));
}
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Station Announcement from {sender}: {message}");
}

/// <summary>
/// Dispatches an announcement on a specific station
/// </summary>
Expand Down Expand Up @@ -370,7 +400,7 @@ public void DispatchStationAnnouncement(

if (playDefaultSound)
{
_audio.PlayGlobal(announcementSound?.GetSound() ?? DefaultAnnouncementSound, filter, true, AudioParams.Default.WithVolume(-2f));
_audio.PlayGlobal(announcementSound?.ToString() ?? DefaultAnnouncementSound, filter, true, AudioParams.Default.WithVolume(-2f));
}

_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Station Announcement on {station} from {sender}: {message}");
Expand Down
8 changes: 8 additions & 0 deletions Content.Server/Communications/CommunicationsConsoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using Content.Shared.DeviceNetwork;
using Content.Shared.Emag.Components;
using Content.Shared.Popups;
using Content.Shared.Silicons.Borgs.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;

Expand Down Expand Up @@ -255,10 +256,17 @@ private void OnAnnounceMessage(EntityUid uid, CommunicationsConsoleComponent com
return;
}

// User has an id
if (_idCardSystem.TryFindIdCard(mob, out var id))
{
author = $"{id.Comp.FullName} ({CultureInfo.CurrentCulture.TextInfo.ToTitleCase(id.Comp.JobTitle ?? string.Empty)})".Trim();
}

// User does not have an id and is a borg, so use the borg's name
if (HasComp<BorgChassisComponent>(mob))
{
author = Name(mob).Trim();
}
}

comp.AnnouncementCooldownRemaining = comp.Delay;
Expand Down
Loading

0 comments on commit 6474a33

Please sign in to comment.