Skip to content

Commit

Permalink
Merge branch 'master-ru' of https://gitlab.workbench.network/Workbenc…
Browse files Browse the repository at this point in the history
…h-Team/space-station-14 into arumoon-server

# Conflicts:
#	Resources/Locale/en-US/reagents/meta/consumable/drink/drinks.ftl
#	Resources/Locale/ru-RU/reagents/meta/consumable/drink/drinks.ftl
#	Resources/Maps/metastation.yml
#	Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_bottles.yml
#	Resources/Textures/Structures/Wallmounts/posters.rsi/meta.json
  • Loading branch information
MilenVolf committed Jan 11, 2025
2 parents e73b010 + a759e78 commit 9926269
Show file tree
Hide file tree
Showing 111 changed files with 8,681 additions and 4,856 deletions.
9 changes: 5 additions & 4 deletions Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public void UpdateDeviceData(string addr, IAtmosDeviceData device)
if (!_pumps.TryGetValue(addr, out var pumpControl))
{
var control= new PumpControl(pump, addr);
control.PumpDataChanged += AtmosDeviceDataChanged!.Invoke;
control.PumpDataCopied += AtmosDeviceDataCopied!.Invoke;
control.PumpDataChanged += AtmosDeviceDataChanged;
control.PumpDataCopied += AtmosDeviceDataCopied;
_pumps.Add(addr, control);
CVentContainer.AddChild(control);
}
Expand All @@ -145,8 +145,8 @@ public void UpdateDeviceData(string addr, IAtmosDeviceData device)
if (!_scrubbers.TryGetValue(addr, out var scrubberControl))
{
var control = new ScrubberControl(scrubber, addr);
control.ScrubberDataChanged += AtmosDeviceDataChanged!.Invoke;
control.ScrubberDataCopied += AtmosDeviceDataCopied!.Invoke;
control.ScrubberDataChanged += AtmosDeviceDataChanged;
control.ScrubberDataCopied += AtmosDeviceDataCopied;
_scrubbers.Add(addr, control);
CScrubberContainer.AddChild(control);
}
Expand All @@ -161,6 +161,7 @@ public void UpdateDeviceData(string addr, IAtmosDeviceData device)
{
var control = new SensorInfo(sensor, addr);
control.OnThresholdUpdate += AtmosAlarmThresholdChanged;
control.SensorDataCopied += AtmosDeviceDataCopied;
_sensors.Add(addr, control);
CSensorContainer.AddChild(control);
}
Expand Down
8 changes: 4 additions & 4 deletions Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public PumpControl(GasVentPumpData data, string address)
PumpDataChanged?.Invoke(_address, _data);
};

_copySettings.OnPressed += _ =>
{
PumpDataCopied?.Invoke(_data);
};
_copySettings.OnPressed += _ =>
{
PumpDataCopied?.Invoke(_data);
};
}

public void ChangeData(GasVentPumpData data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ public ScrubberControl(GasVentScrubberData data, string address)
ScrubberDataChanged?.Invoke(_address, _data);
};

_copySettings.OnPressed += _ =>
{
ScrubberDataCopied?.Invoke(_data);
};
_copySettings.OnPressed += _ =>
{
ScrubberDataCopied?.Invoke(_data);
};

foreach (var value in Enum.GetValues<Gas>())
{
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<CollapsibleHeading Name="SensorAddress" />
<CollapsibleBody Margin="20 2 2 2">
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
<BoxContainer Orientation="Horizontal" Margin ="0 0 0 2">
<Button Name="CCopySettings" Text="{Loc 'air-alarm-ui-thresholds-copy'}" ToolTip="{Loc 'air-alarm-ui-thresholds-copy-tooltip'}" />
</BoxContainer>
<BoxContainer Orientation="Vertical" Margin="0 0 2 0" HorizontalExpand="True">
<RichTextLabel Name="AlarmStateLabel" />
<RichTextLabel Name="PressureLabel" />
Expand Down
13 changes: 10 additions & 3 deletions Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ namespace Content.Client.Atmos.Monitor.UI.Widgets;
public sealed partial class SensorInfo : BoxContainer
{
public Action<string, AtmosMonitorThresholdType, AtmosAlarmThreshold, Gas?>? OnThresholdUpdate;
public event Action<AtmosSensorData>? SensorDataCopied;
private string _address;

private ThresholdControl _pressureThreshold;
private ThresholdControl _temperatureThreshold;
private Dictionary<Gas, ThresholdControl> _gasThresholds = new();
private Dictionary<Gas, RichTextLabel> _gasLabels = new();
private Button _copySettings => CCopySettings;

public SensorInfo(AtmosSensorData data, string address)
{
Expand Down Expand Up @@ -56,7 +58,7 @@ public SensorInfo(AtmosSensorData data, string address)
gasThresholdControl.Margin = new Thickness(20, 2, 2, 2);
gasThresholdControl.ThresholdDataChanged += (type, alarmThreshold, arg3) =>
{
OnThresholdUpdate!(_address, type, alarmThreshold, arg3);
OnThresholdUpdate?.Invoke(_address, type, alarmThreshold, arg3);
};

_gasThresholds.Add(gas, gasThresholdControl);
Expand All @@ -72,12 +74,17 @@ public SensorInfo(AtmosSensorData data, string address)

_pressureThreshold.ThresholdDataChanged += (type, threshold, arg3) =>
{
OnThresholdUpdate!(_address, type, threshold, arg3);
OnThresholdUpdate?.Invoke(_address, type, threshold, arg3);
};

_temperatureThreshold.ThresholdDataChanged += (type, threshold, arg3) =>
{
OnThresholdUpdate!(_address, type, threshold, arg3);
OnThresholdUpdate?.Invoke(_address, type, threshold, arg3);
};

_copySettings.OnPressed += _ =>
{
SensorDataCopied?.Invoke(data);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ await server.WaitAssertion(() =>
{
playerUid = serverPlayerManager.Sessions.Single().AttachedEntity.GetValueOrDefault();
#pragma warning disable NUnit2045 // Interdependent assertions.
Assert.That(playerUid, Is.Not.EqualTo(default));
Assert.That(playerUid, Is.Not.EqualTo(default(EntityUid)));
// Making sure it exists
Assert.That(entManager.HasComponent<AlertsComponent>(playerUid));
#pragma warning restore NUnit2045
Expand Down
3 changes: 1 addition & 2 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using Robust.Shared.Map.Components;
using Robust.Shared.Prototypes;
using Content.Shared.Station.Components;
using FastAccessors;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;

Expand Down Expand Up @@ -70,7 +69,7 @@ public sealed class PostMapInitTest
"Loop",
"Elkridge"


};

/// <summary>
Expand Down
14 changes: 7 additions & 7 deletions Content.Server/Access/Systems/AccessOverriderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ private void UpdateUserInterface(EntityUid uid, AccessOverriderComponent compone
targetLabel = Loc.GetString("access-overrider-window-target-label") + " " + EntityManager.GetComponent<MetaDataComponent>(component.TargetAccessReaderId).EntityName;
targetLabelColor = Color.White;

if (!_accessReader.GetMainAccessReader(accessReader, out var accessReaderComponent))
if (!_accessReader.GetMainAccessReader(accessReader, out var accessReaderEnt))
return;

var currentAccessHashsets = accessReaderComponent.AccessLists;
var currentAccessHashsets = accessReaderEnt.Value.Comp.AccessLists;
currentAccess = ConvertAccessHashSetsToList(currentAccessHashsets).ToArray();
}

Expand Down Expand Up @@ -210,10 +210,10 @@ private void TryWriteToTargetAccessReaderId(EntityUid uid,
return;
}

if (!_accessReader.GetMainAccessReader(component.TargetAccessReaderId, out var accessReader))
if (!_accessReader.GetMainAccessReader(component.TargetAccessReaderId, out var accessReaderEnt))
return;

var oldTags = ConvertAccessHashSetsToList(accessReader.AccessLists);
var oldTags = ConvertAccessHashSetsToList(accessReaderEnt.Value.Comp.AccessLists);
var privilegedId = component.PrivilegedIdSlot.Item;

if (oldTags.SequenceEqual(newAccessList))
Expand Down Expand Up @@ -242,10 +242,10 @@ private void TryWriteToTargetAccessReaderId(EntityUid uid,
var removedTags = oldTags.Except(newAccessList).Select(tag => "-" + tag).ToList();

_adminLogger.Add(LogType.Action, LogImpact.Medium,
$"{ToPrettyString(player):player} has modified {ToPrettyString(component.TargetAccessReaderId):entity} with the following allowed access level holders: [{string.Join(", ", addedTags.Union(removedTags))}] [{string.Join(", ", newAccessList)}]");
$"{ToPrettyString(player):player} has modified {ToPrettyString(accessReaderEnt.Value):entity} with the following allowed access level holders: [{string.Join(", ", addedTags.Union(removedTags))}] [{string.Join(", ", newAccessList)}]");

accessReader.AccessLists = ConvertAccessListToHashSet(newAccessList);
Dirty(component.TargetAccessReaderId, accessReader);
accessReaderEnt.Value.Comp.AccessLists = ConvertAccessListToHashSet(newAccessList);
Dirty(accessReaderEnt.Value);
}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions Content.Server/Administration/Commands/AdminWhoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
var first = true;
foreach (var admin in adminMgr.ActiveAdmins)
{
if (!first)
sb.Append('\n');
first = false;

var adminData = adminMgr.GetAdminData(admin)!;
DebugTools.AssertNotNull(adminData);

if (adminData.Stealth && !seeStealth)
continue;

if (!first)
sb.Append('\n');
first = false;

sb.Append(admin.Name);
if (adminData.Title is { } title)
sb.Append($": [{title}]");
Expand Down
20 changes: 20 additions & 0 deletions Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,19 @@ private void SetThreshold(EntityUid uid, string address, AtmosMonitorThresholdTy
SyncDevice(uid, address);
}

private void SetAllThresholds(EntityUid uid, string address, AtmosSensorData data)
{
var payload = new NetworkPayload
{
[DeviceNetworkConstants.Command] = AtmosMonitorSystem.AtmosMonitorSetAllThresholdsCmd,
[AtmosMonitorSystem.AtmosMonitorAllThresholdData] = data
};

_deviceNet.QueuePacket(uid, address, payload);

SyncDevice(uid, address);
}

/// <summary>
/// Sync this air alarm's mode with the rest of the network.
/// </summary>
Expand Down Expand Up @@ -341,6 +354,13 @@ private void OnCopyDeviceData(EntityUid uid, AirAlarmComponent component, AirAla
SetData(uid, addr, args.Data);
}
break;

case AtmosSensorData sensorData:
foreach (string addr in component.SensorData.Keys)
{
SetAllThresholds(uid, addr, sensorData);
}
break;
}
}

Expand Down
26 changes: 24 additions & 2 deletions Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ public sealed class AtmosMonitorSystem : EntitySystem

// Commands
public const string AtmosMonitorSetThresholdCmd = "atmos_monitor_set_threshold";
public const string AtmosMonitorSetAllThresholdsCmd = "atmos_monitor_set_all_thresholds";

// Packet data
public const string AtmosMonitorThresholdData = "atmos_monitor_threshold_data";

public const string AtmosMonitorAllThresholdData = "atmos_monitor_all_threshold_data";
public const string AtmosMonitorThresholdDataType = "atmos_monitor_threshold_type";

public const string AtmosMonitorThresholdGasType = "atmos_monitor_threshold_gas";
Expand Down Expand Up @@ -138,7 +139,12 @@ private void OnPacketRecv(EntityUid uid, AtmosMonitorComponent component, Device
args.Data.TryGetValue(AtmosMonitorThresholdGasType, out Gas? gas);
SetThreshold(uid, thresholdType.Value, thresholdData, gas);
}

break;
case AtmosMonitorSetAllThresholdsCmd:
if (args.Data.TryGetValue(AtmosMonitorAllThresholdData, out AtmosSensorData? allThresholdData))
{
SetAllThresholds(uid, allThresholdData);
}
break;
case AtmosDeviceNetworkSystem.SyncData:
var payload = new NetworkPayload();
Expand Down Expand Up @@ -403,4 +409,20 @@ public void SetThreshold(EntityUid uid, AtmosMonitorThresholdType type, AtmosAla
}

}

/// <summary>
/// Sets all of a monitor's thresholds at once according to the incoming
/// AtmosSensorData object's thresholds.
/// </summary>
/// <param name="uid">The entity's uid</param>
/// <param name="allThresholdData">An AtmosSensorData object from which the thresholds will be loaded.</param>
public void SetAllThresholds(EntityUid uid, AtmosSensorData allThresholdData)
{
SetThreshold(uid, AtmosMonitorThresholdType.Temperature, allThresholdData.TemperatureThreshold);
SetThreshold(uid, AtmosMonitorThresholdType.Pressure, allThresholdData.PressureThreshold);
foreach (var gas in Enum.GetValues<Gas>())
{
SetThreshold(uid, AtmosMonitorThresholdType.Gas, allThresholdData.GasThresholds[gas], gas);
}
}
}
5 changes: 5 additions & 0 deletions Content.Server/Explosion/EntitySystems/ExplosionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,11 @@ public void QueueExplosion(MapCoordinates epicenter,
// + if the bomb is big enough, people outside of it too
// this is capped to 30 because otherwise really huge bombs
// will attempt to play regular audio for people who can't hear it anyway because the epicenter is so far away
//
// TODO EXPLOSION redo this.
// Use the Filter.Pvs range-multiplier option instead of AddInRange.
// Also the default PVS range is 25*2 = 50. So capping it at 30 makes no sense here.
// So actually maybe don't use Filter.Pvs at all and only use AddInRange?
var audioRange = Math.Min(iterationIntensity.Count * 2, MaxExplosionAudioRange);
var filter = Filter.Pvs(pos).AddInRange(pos, audioRange);
var sound = iterationIntensity.Count < queued.Proto.SmallSoundIterationThreshold
Expand Down
37 changes: 37 additions & 0 deletions Content.Server/Ghost/Components/SpookySpeakerComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Content.Shared.Dataset;
using Robust.Shared.Prototypes;

namespace Content.Server.Ghost.Components;

/// <summary>
/// Causes this entity to react to ghost player using the "Boo!" action by speaking
/// a randomly chosen message from a specified set.
/// </summary>
[RegisterComponent, AutoGenerateComponentPause]
public sealed partial class SpookySpeakerComponent : Component
{
/// <summary>
/// ProtoId of the LocalizedDataset to use for messages.
/// </summary>
[DataField(required: true)]
public ProtoId<LocalizedDatasetPrototype> MessageSet;

/// <summary>
/// Probability that this entity will speak if activated by a Boo action.
/// This is so whole banks of entities don't trigger at the same time.
/// </summary>
[DataField]
public float SpeakChance = 0.5f;

/// <summary>
/// Minimum time that must pass after speaking before this entity can speak again.
/// </summary>
[DataField]
public TimeSpan Cooldown = TimeSpan.FromSeconds(30);

/// <summary>
/// Time when the cooldown will have elapsed and the entity can speak again.
/// </summary>
[DataField, AutoPausedField]
public TimeSpan NextSpeakTime;
}
11 changes: 10 additions & 1 deletion Content.Server/Ghost/GhostSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Events;
using Content.Shared.Movement.Systems;
using Content.Shared.Popups;
using Content.Shared.Storage.Components;
using Robust.Server.GameObjects;
using Robust.Server.Player;
Expand All @@ -33,6 +34,7 @@
using Robust.Shared.Physics.Systems;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;

namespace Content.Server.Ghost
Expand Down Expand Up @@ -61,6 +63,8 @@ public sealed class GhostSystem : SharedGhostSystem
[Dependency] private readonly SharedMindSystem _mind = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly IRobustRandom _random = default!;

private EntityQuery<GhostComponent> _ghostQuery;
private EntityQuery<PhysicsComponent> _physicsQuery;
Expand Down Expand Up @@ -125,7 +129,9 @@ private void OnActionPerform(EntityUid uid, GhostComponent component, BooActionE
if (args.Handled)
return;

var entities = _lookup.GetEntitiesInRange(args.Performer, component.BooRadius);
var entities = _lookup.GetEntitiesInRange(args.Performer, component.BooRadius).ToList();
// Shuffle the possible targets so we don't favor any particular entities
_random.Shuffle(entities);

var booCounter = 0;
foreach (var ent in entities)
Expand All @@ -139,6 +145,9 @@ private void OnActionPerform(EntityUid uid, GhostComponent component, BooActionE
break;
}

if (booCounter == 0)
_popup.PopupEntity(Loc.GetString("ghost-component-boo-action-failed"), uid, uid);

args.Handled = true;
}

Expand Down
Loading

0 comments on commit 9926269

Please sign in to comment.