Skip to content

Commit

Permalink
Merge remote-tracking branch 'wizard/master' into upstream-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxup committed Jul 18, 2024
2 parents 5bde087 + 58a2a4c commit 6079a7b
Show file tree
Hide file tree
Showing 185 changed files with 1,028 additions and 780 deletions.
9 changes: 8 additions & 1 deletion Content.Client/Access/UI/AccessLevelControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ namespace Content.Client.Access.UI;
[GenerateTypedNameReferences]
public sealed partial class AccessLevelControl : GridContainer
{
[Dependency] private readonly ILogManager _logManager = default!;

private ISawmill _sawmill = default!;

public readonly Dictionary<ProtoId<AccessLevelPrototype>, Button> ButtonsList = new();

public AccessLevelControl()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

_sawmill = _logManager.GetSawmill("accesslevelcontrol");
}

public void Populate(List<ProtoId<AccessLevelPrototype>> accessLevels, IPrototypeManager prototypeManager)
Expand All @@ -25,7 +32,7 @@ public void Populate(List<ProtoId<AccessLevelPrototype>> accessLevels, IPrototyp
{
if (!prototypeManager.TryIndex(access, out var accessLevel))
{
Logger.Error($"Unable to find accesslevel for {access}");
_sawmill.Error($"Unable to find accesslevel for {access}");
continue;
}

Expand Down
12 changes: 10 additions & 2 deletions Content.Client/Audio/AudioUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void SetClickSound(string value)
{
if (!string.IsNullOrEmpty(value))
{
var resource = _cache.GetResource<AudioResource>(value);
var resource = GetSoundOrFallback(value, CCVars.UIClickSound.DefaultValue);
var source =
_audioManager.CreateAudioSource(resource);

Expand All @@ -77,7 +77,7 @@ private void SetHoverSound(string value)
{
if (!string.IsNullOrEmpty(value))
{
var hoverResource = _cache.GetResource<AudioResource>(value);
var hoverResource = GetSoundOrFallback(value, CCVars.UIHoverSound.DefaultValue);
var hoverSource =
_audioManager.CreateAudioSource(hoverResource);

Expand All @@ -95,4 +95,12 @@ private void SetHoverSound(string value)
UIManager.SetHoverSound(null);
}
}

private AudioResource GetSoundOrFallback(string path, string fallback)
{
if (!_cache.TryGetResource(path, out AudioResource? resource))
return _cache.GetResource<AudioResource>(fallback);

return resource;
}
}
1 change: 1 addition & 0 deletions Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Content.Shared.Random;
using Content.Shared.Random.Rules;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Client.ResourceManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Content.Shared.Research;
using Content.Shared.Research.Components;
using Robust.Client.GameObjects;

namespace Content.Client.Research.UI
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Content.Shared.Research.Components;
using Robust.Client.GameObjects;

namespace Content.Client.Research.UI
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Content.Shared.Research.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

namespace Content.Client.Research.UI;

Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void UpdatePanels(ResearchConsoleBoundInterfaceState state)
public void UpdateInformationPanel(ResearchConsoleBoundInterfaceState state)
{
var amountMsg = new FormattedMessage();
amountMsg.AddMarkup(Loc.GetString("research-console-menu-research-points-text",
amountMsg.AddMarkupOrThrow(Loc.GetString("research-console-menu-research-points-text",
("points", state.Points)));
ResearchAmountLabel.SetMessage(amountMsg);

Expand All @@ -98,7 +98,7 @@ public void UpdateInformationPanel(ResearchConsoleBoundInterfaceState state)
}

var msg = new FormattedMessage();
msg.AddMarkup(Loc.GetString("research-console-menu-main-discipline",
msg.AddMarkupOrThrow(Loc.GetString("research-console-menu-main-discipline",
("name", disciplineText), ("color", disciplineColor)));
MainDisciplineLabel.SetMessage(msg);

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Research/UI/TechnologyCardControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public TechnologyCardControl(TechnologyPrototype technology, IPrototypeManager p
DisciplineTexture.Texture = spriteSys.Frame0(discipline.Icon);
TechnologyNameLabel.Text = Loc.GetString(technology.Name);
var message = new FormattedMessage();
message.AddMarkup(Loc.GetString("research-console-tier-discipline-info",
message.AddMarkupOrThrow(Loc.GetString("research-console-tier-discipline-info",
("tier", technology.Tier), ("color", discipline.Color), ("discipline", Loc.GetString(discipline.Name))));
TierLabel.SetMessage(message);
UnlocksLabel.SetMessage(description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System.Linq;
using Content.Client.CharacterInfo;
using Content.Client.Gameplay;
using Content.Client.Message; // backmen: locale
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Systems.Character.Controls;
using Content.Client.UserInterface.Systems.Character.Windows;
using Content.Client.UserInterface.Systems.Objectives.Controls;
using Content.Shared.Input;
using Content.Shared.Objectives.Systems;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Player;
Expand Down Expand Up @@ -173,15 +174,17 @@ private void CharacterUpdated(CharacterData data)
Modulate = Color.Gray
};

// start-backmen: locale
var objectiveControlLabel = new RichTextLabel

var objectiveText = new FormattedMessage();
objectiveText.TryAddMarkup(Loc.GetString($"issuer-{groupId}"), out _); // backmen: locale

var objectiveLabel = new RichTextLabel
{
Modulate = Color.LightSkyBlue
StyleClasses = {StyleNano.StyleClassTooltipActionTitle}
};
objectiveControlLabel.SetMarkup(Loc.GetString($"issuer-{groupId}"));
objectiveLabel.SetMessage(objectiveText);

objectiveControl.AddChild(objectiveControlLabel);
// end-backmen: locale
objectiveControl.AddChild(objectiveLabel);

foreach (var condition in conditions)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
namespace Content.Server.Administration.Commands;

[AdminCommand(AdminFlags.Admin)]
public sealed class AGhost : LocalizedCommands
public sealed class AGhostCommand : LocalizedCommands
{
[Dependency] private readonly IEntityManager _entities = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;

public override string Command => "aghost";
public override string Description => LocalizationManager.GetString("aghost-description");
public override string Help => "aghost";

public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
Expand Down
40 changes: 20 additions & 20 deletions Content.Server/Anomaly/AnomalySystem.Scanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,22 @@ public FormattedMessage GetScannerMessage(AnomalyScannerComponent component)
var msg = new FormattedMessage();
if (component.ScannedAnomaly is not { } anomaly || !TryComp<AnomalyComponent>(anomaly, out var anomalyComp))
{
msg.AddMarkup(Loc.GetString("anomaly-scanner-no-anomaly"));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-no-anomaly"));
return msg;
}

TryComp<SecretDataAnomalyComponent>(anomaly, out var secret);

//Severity
if (secret != null && secret.Secret.Contains(AnomalySecretData.Severity))
msg.AddMarkup(Loc.GetString("anomaly-scanner-severity-percentage-unknown"));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-severity-percentage-unknown"));
else
msg.AddMarkup(Loc.GetString("anomaly-scanner-severity-percentage", ("percent", anomalyComp.Severity.ToString("P"))));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-severity-percentage", ("percent", anomalyComp.Severity.ToString("P"))));
msg.PushNewline();

//Stability
if (secret != null && secret.Secret.Contains(AnomalySecretData.Stability))
msg.AddMarkup(Loc.GetString("anomaly-scanner-stability-unknown"));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-stability-unknown"));
else
{
string stateLoc;
Expand All @@ -166,54 +166,54 @@ public FormattedMessage GetScannerMessage(AnomalyScannerComponent component)
stateLoc = Loc.GetString("anomaly-scanner-stability-high");
else
stateLoc = Loc.GetString("anomaly-scanner-stability-medium");
msg.AddMarkup(stateLoc);
msg.AddMarkupOrThrow(stateLoc);
}
msg.PushNewline();

//Point output
if (secret != null && secret.Secret.Contains(AnomalySecretData.OutputPoint))
msg.AddMarkup(Loc.GetString("anomaly-scanner-point-output-unknown"));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-point-output-unknown"));
else
msg.AddMarkup(Loc.GetString("anomaly-scanner-point-output", ("point", GetAnomalyPointValue(anomaly, anomalyComp))));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-point-output", ("point", GetAnomalyPointValue(anomaly, anomalyComp))));
msg.PushNewline();
msg.PushNewline();

//Particles title
msg.AddMarkup(Loc.GetString("anomaly-scanner-particle-readout"));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-particle-readout"));
msg.PushNewline();

//Danger
if (secret != null && secret.Secret.Contains(AnomalySecretData.ParticleDanger))
msg.AddMarkup(Loc.GetString("anomaly-scanner-particle-danger-unknown"));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-particle-danger-unknown"));
else
msg.AddMarkup(Loc.GetString("anomaly-scanner-particle-danger", ("type", GetParticleLocale(anomalyComp.SeverityParticleType))));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-particle-danger", ("type", GetParticleLocale(anomalyComp.SeverityParticleType))));
msg.PushNewline();

//Unstable
if (secret != null && secret.Secret.Contains(AnomalySecretData.ParticleUnstable))
msg.AddMarkup(Loc.GetString("anomaly-scanner-particle-unstable-unknown"));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-particle-unstable-unknown"));
else
msg.AddMarkup(Loc.GetString("anomaly-scanner-particle-unstable", ("type", GetParticleLocale(anomalyComp.DestabilizingParticleType))));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-particle-unstable", ("type", GetParticleLocale(anomalyComp.DestabilizingParticleType))));
msg.PushNewline();

//Containment
if (secret != null && secret.Secret.Contains(AnomalySecretData.ParticleContainment))
msg.AddMarkup(Loc.GetString("anomaly-scanner-particle-containment-unknown"));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-particle-containment-unknown"));
else
msg.AddMarkup(Loc.GetString("anomaly-scanner-particle-containment", ("type", GetParticleLocale(anomalyComp.WeakeningParticleType))));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-particle-containment", ("type", GetParticleLocale(anomalyComp.WeakeningParticleType))));
msg.PushNewline();

//Transformation
if (secret != null && secret.Secret.Contains(AnomalySecretData.ParticleTransformation))
msg.AddMarkup(Loc.GetString("anomaly-scanner-particle-transformation-unknown"));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-particle-transformation-unknown"));
else
msg.AddMarkup(Loc.GetString("anomaly-scanner-particle-transformation", ("type", GetParticleLocale(anomalyComp.TransformationParticleType))));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-particle-transformation", ("type", GetParticleLocale(anomalyComp.TransformationParticleType))));


//Behavior
msg.PushNewline();
msg.PushNewline();
msg.AddMarkup(Loc.GetString("anomaly-behavior-title"));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-behavior-title"));
msg.PushNewline();

if (secret != null && secret.Secret.Contains(AnomalySecretData.Behavior))
Expand All @@ -224,14 +224,14 @@ public FormattedMessage GetScannerMessage(AnomalyScannerComponent component)
{
var behavior = _prototype.Index(anomalyComp.CurrentBehavior.Value);

msg.AddMarkup("- " + Loc.GetString(behavior.Description));
msg.AddMarkupOrThrow("- " + Loc.GetString(behavior.Description));
msg.PushNewline();
var mod = Math.Floor((behavior.EarnPointModifier) * 100);
msg.AddMarkup("- " + Loc.GetString("anomaly-behavior-point", ("mod", mod)));
msg.AddMarkupOrThrow("- " + Loc.GetString("anomaly-behavior-point", ("mod", mod)));
}
else
{
msg.AddMarkup(Loc.GetString("anomaly-behavior-balanced"));
msg.AddMarkupOrThrow(Loc.GetString("anomaly-behavior-balanced"));
}
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Botany/Components/SeedComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public sealed partial class SeedComponent : SharedSeedComponent
/// <summary>
/// Name of a base seed prototype that is used if <see cref="Seed"/> is null.
/// </summary>
[DataField("seedId", customTypeSerializer:typeof(PrototypeIdSerializer<SeedPrototype>))]
[DataField("seedId", customTypeSerializer: typeof(PrototypeIdSerializer<SeedPrototype>))]
public string? SeedId;
}
}
8 changes: 4 additions & 4 deletions Content.Server/Botany/Systems/MutationSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
using Robust.Shared.Random;
using Content.Shared.Random;
using Content.Shared.Random.Helpers;
using Content.Shared.Chemistry.Reagent;
using System.Linq;
using Content.Shared.Atmos;
using FastAccessors;

namespace Content.Server.Botany;

Expand Down Expand Up @@ -42,6 +40,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;

#pragma warning disable IDE0055 // disable formatting warnings because this looks more readable
// Tolerances (55)
MutateFloat(ref seed.NutrientConsumption , 0.05f, 1.2f, 5, totalbits, severity);
MutateFloat(ref seed.WaterConsumption , 3f , 9f , 5, totalbits, severity);
Expand Down Expand Up @@ -75,6 +74,7 @@ public void MutateSeed(ref SeedData seed, float severity)
MutateBool(ref seed.TurnIntoKudzu , true , 10, totalbits, severity);
MutateBool(ref seed.CanScream , true , 10, totalbits, severity);
seed.BioluminescentColor = RandomColor(seed.BioluminescentColor, 10, totalbits, severity);
#pragma warning restore IDE0055

// ConstantUpgade (10)
MutateHarvestType(ref seed.HarvestRepeat, 10, totalbits, severity);
Expand Down Expand Up @@ -261,7 +261,7 @@ private void MutateChemicals(ref Dictionary<string, SeedChemQuantity> chemicals,
{
var pick = _randomChems.Pick(_robustRandom);
string chemicalId = pick.reagent;
int amount = _robustRandom.Next(1, ((int)pick.quantity));
int amount = _robustRandom.Next(1, (int)pick.quantity);
SeedChemQuantity seedChemQuantity = new SeedChemQuantity();
if (chemicals.ContainsKey(chemicalId))
{
Expand All @@ -274,7 +274,7 @@ private void MutateChemicals(ref Dictionary<string, SeedChemQuantity> chemicals,
seedChemQuantity.Max = 1 + amount;
seedChemQuantity.Inherent = false;
}
int potencyDivisor = (int) Math.Ceiling(100.0f / seedChemQuantity.Max);
int potencyDivisor = (int)Math.Ceiling(100.0f / seedChemQuantity.Max);
seedChemQuantity.PotencyDivisor = potencyDivisor;
chemicals[chemicalId] = seedChemQuantity;
}
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Botany/Systems/SeedExtractorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ private void OnInteractUsing(EntityUid uid, SeedExtractorComponent seedExtractor
return;
if (!_botanySystem.TryGetSeed(produce, out var seed) || seed.Seedless)
{
_popupSystem.PopupCursor(Loc.GetString("seed-extractor-component-no-seeds",("name", args.Used)),
_popupSystem.PopupCursor(Loc.GetString("seed-extractor-component-no-seeds", ("name", args.Used)),
args.User, PopupType.MediumCaution);
return;
}

_popupSystem.PopupCursor(Loc.GetString("seed-extractor-component-interact-message",("name", args.Used)),
_popupSystem.PopupCursor(Loc.GetString("seed-extractor-component-interact-message", ("name", args.Used)),
args.User, PopupType.Medium);

QueueDel(args.Used);
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/CharacterInfo/CharacterInfoSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ private void OnRequestCharacterInfoEvent(RequestCharacterInfoEvent msg, EntitySe
if (_minds.TryGetMind(entity, out var mindId, out var mind))
{
// Get objectives
foreach (var objective in mind.AllObjectives)
foreach (var objective in mind.Objectives)
{
var info = _objectives.GetInfo(objective, mindId, mind);
if (info == null)
continue;

// group objectives by their issuer
var issuer = Comp<ObjectiveComponent>(objective).Issuer;
var issuer = Comp<ObjectiveComponent>(objective).LocIssuer;
if (!objectives.ContainsKey(issuer))
objectives[issuer] = new List<ObjectiveInfo>();
objectives[issuer].Add(info.Value);
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Dragon/DragonSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public void DeleteRifts(EntityUid uid, bool resetRole, DragonComponent? comp = n
return;

var mind = Comp<MindComponent>(mindContainer.Mind.Value);
foreach (var objId in mind.AllObjectives)
foreach (var objId in mind.Objectives)
{
if (_objQuery.TryGetComponent(objId, out var obj))
{
Expand All @@ -247,7 +247,7 @@ public void RiftCharged(EntityUid uid, DragonComponent? comp = null)
return;

var mind = Comp<MindComponent>(mindContainer.Mind.Value);
foreach (var objId in mind.AllObjectives)
foreach (var objId in mind.Objectives)
{
if (_objQuery.TryGetComponent(objId, out var obj))
{
Expand Down
7 changes: 7 additions & 0 deletions Content.Server/GameTicking/GameTicker.GameRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,13 @@ private void AddGameRuleCommand(IConsoleShell shell, string argstr, string[] arg

foreach (var rule in args)
{
if (!_prototypeManager.HasIndex(rule))
{
shell.WriteError($"Invalid game rule {rule} was skipped.");

continue;
}

if (shell.Player != null)
{
_adminLogger.Add(LogType.EventStarted, $"{shell.Player} tried to add game rule [{rule}] via command");
Expand Down
Loading

0 comments on commit 6079a7b

Please sign in to comment.