Skip to content

Commit

Permalink
Merge branch 'master' into Languages
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxoTrystan authored May 5, 2024
2 parents 54dee4f + 2ccbdd3 commit 87a0a87
Show file tree
Hide file tree
Showing 240 changed files with 3,623 additions and 1,341 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Alerts/ClientAlertsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void LoadPrototypes()

AlertOrder = _prototypeManager.EnumeratePrototypes<AlertOrderPrototype>().FirstOrDefault();
if (AlertOrder == null)
Log.Error("alert", "no alertOrder prototype found, alerts will be in random order");
Log.Error("No alertOrder prototype found, alerts will be in random order");
}

public IReadOnlyDictionary<AlertKey, AlertState>? ActiveAlerts
Expand Down
6 changes: 3 additions & 3 deletions Content.Client/Audio/ContentAudioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void FadeIn(EntityUid? stream, AudioComponent? component = null, float du

_fadingOut.Remove(stream.Value);
var curVolume = component.Volume;
var change = (curVolume - MinVolume) / duration;
var change = (MinVolume - curVolume) / duration;
_fadingIn.Add(stream.Value, (change, component.Volume));
component.Volume = MinVolume;
}
Expand Down Expand Up @@ -151,8 +151,8 @@ private void UpdateFades(float frameTime)
continue;
}

var volume = component.Volume + change * frameTime;
volume = MathF.Max(target, volume);
var volume = component.Volume - change * frameTime;
volume = MathF.Min(target, volume);
_audio.SetVolume(stream, volume, component);

if (component.Volume.Equals(target))
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Clothing/ClientClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot
{
if (!revealedLayers.Add(key))
{
Logger.Warning($"Duplicate key for clothing visuals: {key}. Are multiple components attempting to modify the same layer? Equipment: {ToPrettyString(equipment)}");
Log.Warning($"Duplicate key for clothing visuals: {key}. Are multiple components attempting to modify the same layer? Equipment: {ToPrettyString(equipment)}");
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ protected override void Open()
SendMessage(new SetStationRecordFilter(type, filterValue));
_window.OnStatusSelected += status =>
SendMessage(new CriminalRecordChangeStatus(status, null));
_window.OnDialogConfirmed += (_, reason) =>
SendMessage(new CriminalRecordChangeStatus(SecurityStatus.Wanted, reason));
_window.OnDialogConfirmed += (status, reason) =>
SendMessage(new CriminalRecordChangeStatus(status, reason));
_window.OnHistoryUpdated += UpdateHistory;
_window.OnHistoryClosed += () => _historyWindow?.Close();
_window.OnClose += Close;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,16 @@ private void FilterListingOfRecords(string text = "")

private void SetStatus(SecurityStatus status)
{
if (status == SecurityStatus.Wanted)
if (status == SecurityStatus.Wanted || status == SecurityStatus.Suspected)
{
GetWantedReason();
GetReason(status);
return;
}

OnStatusSelected?.Invoke(status);
}

private void GetWantedReason()
private void GetReason(SecurityStatus status)
{
if (_reasonDialog != null)
{
Expand All @@ -237,7 +237,7 @@ private void GetWantedReason()
}

var field = "reason";
var title = Loc.GetString("criminal-records-status-wanted");
var title = Loc.GetString("criminal-records-status-" + status.ToString().ToLower());
var placeholders = _proto.Index<DatasetPrototype>(ReasonPlaceholders);
var placeholder = Loc.GetString("criminal-records-console-reason-placeholder", ("placeholder", _random.Pick(placeholders.Values))); // just funny it doesn't actually get used
var prompt = Loc.GetString("criminal-records-console-reason");
Expand All @@ -251,7 +251,7 @@ private void GetWantedReason()
if (reason.Length < 1 || reason.Length > _maxLength)
return;
OnDialogConfirmed?.Invoke(SecurityStatus.Wanted, reason);
OnDialogConfirmed?.Invoke(status, reason);
};

_reasonDialog.OnClose += () => { _reasonDialog = null; };
Expand Down
2 changes: 2 additions & 0 deletions Content.Client/Drugs/DrugOverlaySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ private void OnPlayerAttached(EntityUid uid, SeeingRainbowsComponent component,
private void OnPlayerDetached(EntityUid uid, SeeingRainbowsComponent component, LocalPlayerDetachedEvent args)
{
_overlay.Intoxication = 0;
_overlay.TimeTicker = 0;
_overlayMan.RemoveOverlay(_overlay);
}

Expand All @@ -52,6 +53,7 @@ private void OnShutdown(EntityUid uid, SeeingRainbowsComponent component, Compon
if (_player.LocalEntity == uid)
{
_overlay.Intoxication = 0;
_overlay.TimeTicker = 0;
_overlayMan.RemoveOverlay(_overlay);
}
}
Expand Down
13 changes: 12 additions & 1 deletion Content.Client/Drugs/RainbowOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public sealed class RainbowOverlay : Overlay
private readonly ShaderInstance _rainbowShader;

public float Intoxication = 0.0f;
public float TimeTicker = 0.0f;

private const float VisualThreshold = 10.0f;
private const float PowerDivisor = 250.0f;
Expand Down Expand Up @@ -48,7 +49,17 @@ protected override void FrameUpdate(FrameEventArgs args)
return;

var timeLeft = (float) (time.Value.Item2 - time.Value.Item1).TotalSeconds;
Intoxication += (timeLeft - Intoxication) * args.DeltaSeconds / 16f;

TimeTicker += args.DeltaSeconds;

if (timeLeft - TimeTicker > timeLeft / 16f)
{
Intoxication += (timeLeft - Intoxication) * args.DeltaSeconds / 16f;
}
else
{
Intoxication -= Intoxication/(timeLeft - TimeTicker) * args.DeltaSeconds;
}
}

protected override bool BeforeDraw(in OverlayDrawArgs args)
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/IconSmoothing/IconSmoothSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private void CalculateNewSprite(EntityUid uid,

if (!spriteQuery.TryGetComponent(uid, out var sprite))
{
Logger.Error($"Encountered a icon-smoothing entity without a sprite: {ToPrettyString(uid)}");
Log.Error($"Encountered a icon-smoothing entity without a sprite: {ToPrettyString(uid)}");
RemCompDeferred(uid, smooth);
return;
}
Expand All @@ -242,7 +242,7 @@ private void CalculateNewSprite(EntityUid uid,
{
if (!_mapManager.TryGetGrid(xform.GridUid, out grid))
{
Logger.Error($"Failed to calculate IconSmoothComponent sprite in {uid} because grid {xform.GridUid} was missing.");
Log.Error($"Failed to calculate IconSmoothComponent sprite in {uid} because grid {xform.GridUid} was missing.");
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Info/InfoSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<RulesMessage>(OnRulesReceived);
Logger.DebugS("info", "Requested server info.");
Log.Debug("Requested server info.");
RaiseNetworkEvent(new RequestRulesMessage());
}

private void OnRulesReceived(RulesMessage message, EntitySessionEventArgs eventArgs)
{
Logger.DebugS("info", "Received server rules.");
Log.Debug("Received server rules.");
Rules = message;
_rules.UpdateRules();
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Light/RgbLightControllerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private void GetOriginalColors(EntityUid uid, RgbLightControllerComponent? rgb =
else
{
// admeme fuck-ups or bad yaml?
Logger.Warning($"RGB light attempted to use invalid sprite index {index} on entity {ToPrettyString(uid)}");
Log.Warning($"RGB light attempted to use invalid sprite index {index} on entity {ToPrettyString(uid)}");
rgb.Layers.Remove(index);
}
}
Expand Down
6 changes: 6 additions & 0 deletions Content.Client/MassMedia/Ui/ArticleEditorPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,17 @@ private void OnTextChanged(long length, Control control, long maxLength)
{
control.ModulateSelfOverride = Color.Red;
control.ToolTip = Loc.GetString("news-writer-text-length-exceeded");

ButtonPublish.Disabled = true;
ButtonPreview.Disabled = true;
}
else
{
control.ModulateSelfOverride = null;
control.ToolTip = string.Empty;

ButtonPublish.Disabled = false;
ButtonPreview.Disabled = false;
}
}

Expand Down
7 changes: 6 additions & 1 deletion Content.Client/Movement/Systems/FloorOcclusionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ protected override void SetEnabled(EntityUid uid, FloorOcclusionComponent compon

private void SetShader(SpriteComponent sprite, bool enabled)
{
var shader = _proto.Index<ShaderPrototype>("HorizontalCut").Instance();

if (sprite.PostShader is not null && sprite.PostShader != shader)
return;

if (enabled)
{
sprite.PostShader = _proto.Index<ShaderPrototype>("HorizontalCut").Instance();
sprite.PostShader = shader;
}
else
{
Expand Down
7 changes: 6 additions & 1 deletion Content.Client/Overlays/ShowSecurityIconsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Shared.Mindshield.Components;
using Content.Shared.Overlays;
using Content.Shared.PDA;
using Content.Shared.Security.Components;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Prototypes;
Expand Down Expand Up @@ -74,7 +75,11 @@ private IReadOnlyList<StatusIconPrototype> DecideSecurityIcon(EntityUid uid)
result.Add(icon);
}

// Add arrest icons here, WYCI.
if (TryComp<CriminalRecordComponent>(uid, out var record))
{
if(_prototypeMan.TryIndex<StatusIconPrototype>(record.StatusIcon.Id, out var criminalIcon))
result.Add(criminalIcon);
}

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ public bool IsAllowed(JobPrototype job, [NotNullWhen(false)] out FormattedMessag
return false;
}

if (job.Requirements == null ||
!_cfg.GetCVar(CCVars.GameRoleTimers))
{
return true;
}

var player = _playerManager.LocalSession;
if (player == null)
return true;
Expand All @@ -106,7 +100,7 @@ public bool CheckRoleTime(HashSet<JobRequirement>? requirements, [NotNullWhen(fa
{
reason = null;

if (requirements == null)
if (requirements == null || !_cfg.GetCVar(CCVars.GameRoleTimers))
return true;

var reasons = new List<string>();
Expand Down
14 changes: 11 additions & 3 deletions Content.Client/Shuttles/UI/MapScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,22 @@ private void RebuildMapObjects()

foreach (var grid in _mapManager.GetAllMapGrids(mapComp.MapId))
{
_entManager.TryGetComponent(grid.Owner, out IFFComponent? iffComp);

var gridObj = new GridMapObject()
{
Name = _entManager.GetComponent<MetaDataComponent>(grid.Owner).EntityName,
Entity = grid.Owner
Entity = grid.Owner,
HideButton = iffComp != null && (iffComp.Flags & IFFFlags.HideLabel) != 0x0,
};

// Always show our shuttle immediately
if (grid.Owner == _shuttleEntity)
{
AddMapObject(mapComp.MapId, gridObj);
}
else
else if (iffComp == null ||
(iffComp.Flags & IFFFlags.Hide) == 0x0)
{
_pendingMapObjects.Add((mapComp.MapId, gridObj));
}
Expand Down Expand Up @@ -423,10 +427,14 @@ public void SetMap(MapId mapId, Vector2 position)
/// </summary>
private void AddMapObject(MapId mapId, IMapObject mapObj)
{
var gridContents = _mapHeadings[mapId];
var existing = _mapObjects.GetOrNew(mapId);
existing.Add(mapObj);

if (mapObj.HideButton)
return;

var gridContents = _mapHeadings[mapId];

var gridButton = new Button()
{
Text = mapObj.Name,
Expand Down
5 changes: 4 additions & 1 deletion Content.Client/Shuttles/UI/ShuttleMapControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ protected override void Draw(DrawingHandleScreen handle)
// Rudimentary IFF for now, if IFF hiding on then we don't show on the map at all
if (grid.Owner != _shuttleEntity &&
EntManager.TryGetComponent(grid, out iffComp) &&
(iffComp.Flags & (IFFFlags.Hide | IFFFlags.HideLabel)) != 0x0)
(iffComp.Flags & IFFFlags.Hide) != 0x0)
{
continue;
}
Expand All @@ -367,6 +367,9 @@ protected override void Draw(DrawingHandleScreen handle)
AddMapObject(existingEdges, existingVerts, mapObject);

// Text
if (iffComp != null && (iffComp.Flags & IFFFlags.HideLabel) != 0x0)
continue;

// Force drawing it at this point.
var iffText = _shuttles.GetIFFLabel(grid, self: true, component: iffComp);

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Sprite/RandomSpriteSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void UpdateSpriteComponentAppearance(EntityUid uid, RandomSpriteComponen
{
if (layer.Key is not { } strKey || !int.TryParse(strKey, out index))
{
Logger.Error($"Invalid key `{layer.Key}` for entity with random sprite {ToPrettyString(uid)}");
Log.Error($"Invalid key `{layer.Key}` for entity with random sprite {ToPrettyString(uid)}");
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Administration/Systems/AdminSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void UpdatePlayerList(ICommonSession player)
return value ?? null;
}

private void OnIdentityChanged(IdentityChangedEvent ev)
private void OnIdentityChanged(ref IdentityChangedEvent ev)
{
if (!TryComp<ActorComponent>(ev.CharacterEntity, out var actor))
return;
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Ame/AmeNodeGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public float CalculatePower(int fuel, int cores)
// Fuel is squared so more fuel vastly increases power and efficiency
// We divide by the number of cores so a larger AME is less efficient at the same fuel settings
// this results in all AMEs having the same efficiency at the same fuel-per-core setting
return 2000000f * fuel * fuel / cores;
return 20000f * fuel * fuel / cores; // Delta V - Revert upstream buff for normal AME operation
}

public int GetTotalStability()
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Atmos/EntitySystems/AutomaticAtmosSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private void OnTileChanged(ref TileChangedEvent ev)
if (physics.Mass / ShuttleSystem.TileMassMultiplier >= 7.0f)
{
AddComp<GridAtmosphereComponent>(ev.Entity);
Logger.InfoS("atmos", $"Giving grid {ev.Entity} GridAtmosphereComponent.");
Log.Info($"Giving grid {ev.Entity} GridAtmosphereComponent.");
}
// It's not super important to remove it should the grid become too small again.
// If explosions ever gain the ability to outright shatter grids, do rethink this.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private void OnSelectGasMessage(EntityUid uid, GasFilterComponent filter, GasFil
}
else
{
Logger.Warning("atmos", $"{ToPrettyString(uid)} received GasFilterSelectGasMessage with an invalid ID: {args.ID}");
Log.Warning($"{ToPrettyString(uid)} received GasFilterSelectGasMessage with an invalid ID: {args.ID}");
}
}
else
Expand Down
16 changes: 14 additions & 2 deletions Content.Server/Chemistry/EntitySystems/InjectorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,21 @@ private void InjectDoAfter(Entity<InjectorComponent> injector, EntityUid target,
return;

var actualDelay = MathHelper.Max(injector.Comp.Delay, TimeSpan.FromSeconds(1));
float amountToInject;
if (injector.Comp.ToggleState == InjectorToggleMode.Draw)
{
// additional delay is based on actual volume left to draw in syringe when smaller than transfer amount
amountToInject = Math.Min(injector.Comp.TransferAmount.Float(), (solution.MaxVolume - solution.Volume).Float());
}
else
{
// additional delay is based on actual volume left to inject in syringe when smaller than transfer amount
amountToInject = Math.Min(injector.Comp.TransferAmount.Float(), solution.Volume.Float());
}

// Injections take 0.5 seconds longer per 5u of possible space/content
actualDelay += TimeSpan.FromSeconds(amountToInject / 10);

// Injections take 0.5 seconds longer per additional 5u
actualDelay += TimeSpan.FromSeconds(injector.Comp.TransferAmount.Float() / injector.Comp.Delay.TotalSeconds - 0.5f);

var isTarget = user != target;

Expand Down
3 changes: 3 additions & 0 deletions Content.Server/Communications/CommunicationsConsoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ private void OnBroadcastMessage(EntityUid uid, CommunicationsConsoleComponent co
};

_deviceNetworkSystem.QueuePacket(uid, null, payload, net.TransmitFrequency);

if (message.Session.AttachedEntity != null)
_adminLogger.Add(LogType.DeviceNetwork, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following broadcast: {message.Message:msg}");
}

private void OnCallShuttleMessage(EntityUid uid, CommunicationsConsoleComponent comp, CommunicationsConsoleCallEmergencyShuttleMessage message)
Expand Down
Loading

0 comments on commit 87a0a87

Please sign in to comment.