forked from Rxup/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Rxup:master' into master
Showing
316 changed files
with
229,507 additions
and
161,463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 44 additions & 46 deletions
90
Content.Client/Atmos/UI/GasPressurePumpBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,63 @@ | ||
using Content.Shared.Atmos; | ||
using Content.Shared.Atmos.Components; | ||
using Content.Shared.Atmos.Piping.Binary.Components; | ||
using Content.Shared.IdentityManagement; | ||
using Content.Shared.Localizations; | ||
using JetBrains.Annotations; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.UserInterface; | ||
|
||
namespace Content.Client.Atmos.UI | ||
namespace Content.Client.Atmos.UI; | ||
|
||
/// <summary> | ||
/// Initializes a <see cref="GasPressurePumpWindow"/> and updates it when new server messages are received. | ||
/// </summary> | ||
[UsedImplicitly] | ||
public sealed class GasPressurePumpBoundUserInterface : BoundUserInterface | ||
{ | ||
/// <summary> | ||
/// Initializes a <see cref="GasPressurePumpWindow"/> and updates it when new server messages are received. | ||
/// </summary> | ||
[UsedImplicitly] | ||
public sealed class GasPressurePumpBoundUserInterface : BoundUserInterface | ||
{ | ||
[ViewVariables] | ||
private const float MaxPressure = Atmospherics.MaxOutputPressure; | ||
[ViewVariables] | ||
private const float MaxPressure = Atmospherics.MaxOutputPressure; | ||
|
||
[ViewVariables] | ||
private GasPressurePumpWindow? _window; | ||
|
||
[ViewVariables] | ||
private GasPressurePumpWindow? _window; | ||
public GasPressurePumpBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
|
||
public GasPressurePumpBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
_window = this.CreateWindow<GasPressurePumpWindow>(); | ||
|
||
_window = this.CreateWindow<GasPressurePumpWindow>(); | ||
_window.ToggleStatusButtonPressed += OnToggleStatusButtonPressed; | ||
_window.PumpOutputPressureChanged += OnPumpOutputPressurePressed; | ||
Update(); | ||
} | ||
|
||
_window.ToggleStatusButtonPressed += OnToggleStatusButtonPressed; | ||
_window.PumpOutputPressureChanged += OnPumpOutputPressurePressed; | ||
} | ||
public void Update() | ||
{ | ||
if (_window == null) | ||
return; | ||
|
||
private void OnToggleStatusButtonPressed() | ||
{ | ||
if (_window is null) return; | ||
SendMessage(new GasPressurePumpToggleStatusMessage(_window.PumpStatus)); | ||
} | ||
_window.Title = Identity.Name(Owner, EntMan); | ||
|
||
private void OnPumpOutputPressurePressed(string value) | ||
{ | ||
var pressure = UserInputParser.TryFloat(value, out var parsed) ? parsed : 0f; | ||
if (pressure > MaxPressure) pressure = MaxPressure; | ||
if (!EntMan.TryGetComponent(Owner, out GasPressurePumpComponent? pump)) | ||
return; | ||
|
||
SendMessage(new GasPressurePumpChangeOutputPressureMessage(pressure)); | ||
} | ||
_window.SetPumpStatus(pump.Enabled); | ||
_window.MaxPressure = pump.MaxTargetPressure; | ||
_window.SetOutputPressure(pump.TargetPressure); | ||
} | ||
|
||
/// <summary> | ||
/// Update the UI state based on server-sent info | ||
/// </summary> | ||
/// <param name="state"></param> | ||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
if (_window == null || state is not GasPressurePumpBoundUserInterfaceState cast) | ||
return; | ||
private void OnToggleStatusButtonPressed() | ||
{ | ||
if (_window is null) return; | ||
SendPredictedMessage(new GasPressurePumpToggleStatusMessage(_window.PumpStatus)); | ||
} | ||
|
||
_window.Title = (cast.PumpLabel); | ||
_window.SetPumpStatus(cast.Enabled); | ||
_window.SetOutputPressure(cast.OutputPressure); | ||
} | ||
private void OnPumpOutputPressurePressed(float value) | ||
{ | ||
SendPredictedMessage(new GasPressurePumpChangeOutputPressureMessage(value)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
<DefaultWindow xmlns="https://spacestation14.io" | ||
<controls:FancyWindow xmlns="https://spacestation14.io" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
MinSize="200 120" Title="Pressure Pump"> | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
SetSize="340 110" MinSize="340 110" Title="Pressure Pump"> | ||
<BoxContainer Orientation="Vertical" Margin="5 5 5 5" SeparationOverride="10"> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc comp-gas-pump-ui-pump-status}"/> | ||
<Control MinSize="5 0" /> | ||
<Label Text="{Loc comp-gas-pump-ui-pump-status}" Margin="0 0 5 0"/> | ||
<Button Name="ToggleStatusButton"/> | ||
<Control HorizontalExpand="True"/> | ||
<Button HorizontalAlignment="Right" Name="SetOutputPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-rate}" Disabled="True" Margin="0 0 5 0"/> | ||
<Button Name="SetMaxPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-max}" /> | ||
</BoxContainer> | ||
|
||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc comp-gas-pump-ui-pump-output-pressure}"/> | ||
<Control MinSize="5 0" /> | ||
<LineEdit Name="PumpPressureOutputInput" MinSize="70 0" /> | ||
<Control MinSize="5 0" /> | ||
<Button Name="SetMaxPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-max}" /> | ||
<Control MinSize="5 0" /> | ||
<Control HorizontalExpand="True" /> | ||
<Button Name="SetOutputPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-rate}" HorizontalAlignment="Right" Disabled="True"/> | ||
<FloatSpinBox HorizontalExpand="True" Name="PumpPressureOutputInput" MinSize="70 0" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</DefaultWindow> | ||
</controls:FancyWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 0 additions & 72 deletions
72
Content.Client/Backmen/OfferItem/OfferItemIndicatorsOverlay.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
Content.Server/Atmos/Piping/Binary/Components/GasPressurePumpComponent.cs
This file was deleted.
Oops, something went wrong.
176 changes: 32 additions & 144 deletions
176
Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,169 +1,57 @@ | ||
using Content.Server.Administration.Logs; | ||
using Content.Server.Atmos.EntitySystems; | ||
using Content.Server.Atmos.Piping.Binary.Components; | ||
using Content.Server.Atmos.Piping.Components; | ||
using Content.Server.NodeContainer.EntitySystems; | ||
using Content.Server.NodeContainer.Nodes; | ||
using Content.Server.Power.Components; | ||
using Content.Shared.Atmos; | ||
using Content.Shared.Atmos.Piping; | ||
using Content.Shared.Atmos.Piping.Binary.Components; | ||
using Content.Shared.Atmos.Components; | ||
using Content.Shared.Atmos.EntitySystems; | ||
using Content.Shared.Audio; | ||
using Content.Shared.Database; | ||
using Content.Shared.Examine; | ||
using Content.Shared.Interaction; | ||
using Content.Shared.Popups; | ||
using Content.Shared.Power; | ||
using JetBrains.Annotations; | ||
using Robust.Server.GameObjects; | ||
using Robust.Shared.Player; | ||
|
||
namespace Content.Server.Atmos.Piping.Binary.EntitySystems | ||
{ | ||
[UsedImplicitly] | ||
public sealed class GasPressurePumpSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; | ||
[Dependency] private readonly IAdminLogManager _adminLogger = default!; | ||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; | ||
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; | ||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!; | ||
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!; | ||
[Dependency] private readonly SharedPopupSystem _popup = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<GasPressurePumpComponent, ComponentInit>(OnInit); | ||
SubscribeLocalEvent<GasPressurePumpComponent, AtmosDeviceUpdateEvent>(OnPumpUpdated); | ||
SubscribeLocalEvent<GasPressurePumpComponent, AtmosDeviceDisabledEvent>(OnPumpLeaveAtmosphere); | ||
SubscribeLocalEvent<GasPressurePumpComponent, ExaminedEvent>(OnExamined); | ||
SubscribeLocalEvent<GasPressurePumpComponent, ActivateInWorldEvent>(OnPumpActivate); | ||
SubscribeLocalEvent<GasPressurePumpComponent, PowerChangedEvent>(OnPowerChanged); | ||
// Bound UI subscriptions | ||
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpChangeOutputPressureMessage>(OnOutputPressureChangeMessage); | ||
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpToggleStatusMessage>(OnToggleStatusMessage); | ||
} | ||
|
||
private void OnInit(EntityUid uid, GasPressurePumpComponent pump, ComponentInit args) | ||
{ | ||
UpdateAppearance(uid, pump); | ||
} | ||
|
||
private void OnExamined(EntityUid uid, GasPressurePumpComponent pump, ExaminedEvent args) | ||
{ | ||
if (!EntityManager.GetComponent<TransformComponent>(uid).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. | ||
return; | ||
|
||
if (Loc.TryGetString("gas-pressure-pump-system-examined", out var str, | ||
("statusColor", "lightblue"), // TODO: change with pressure? | ||
("pressure", pump.TargetPressure) | ||
)) | ||
{ | ||
args.PushMarkup(str); | ||
} | ||
} | ||
|
||
private void OnPowerChanged(EntityUid uid, GasPressurePumpComponent component, ref PowerChangedEvent args) | ||
{ | ||
UpdateAppearance(uid, component); | ||
} | ||
|
||
private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, ref AtmosDeviceUpdateEvent args) | ||
{ | ||
if (!pump.Enabled | ||
|| (TryComp<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered) | ||
|| !_nodeContainer.TryGetNodes(uid, pump.InletName, pump.OutletName, out PipeNode? inlet, out PipeNode? outlet)) | ||
{ | ||
_ambientSoundSystem.SetAmbience(uid, false); | ||
return; | ||
} | ||
|
||
var outputStartingPressure = outlet.Air.Pressure; | ||
namespace Content.Server.Atmos.Piping.Binary.EntitySystems; | ||
|
||
if (outputStartingPressure >= pump.TargetPressure) | ||
{ | ||
_ambientSoundSystem.SetAmbience(uid, false); | ||
return; // No need to pump gas if target has been reached. | ||
} | ||
|
||
if (inlet.Air.TotalMoles > 0 && inlet.Air.Temperature > 0) | ||
{ | ||
// We calculate the necessary moles to transfer using our good ol' friend PV=nRT. | ||
var pressureDelta = pump.TargetPressure - outputStartingPressure; | ||
var transferMoles = (pressureDelta * outlet.Air.Volume) / (inlet.Air.Temperature * Atmospherics.R); | ||
|
||
var removed = inlet.Air.Remove(transferMoles); | ||
_atmosphereSystem.Merge(outlet.Air, removed); | ||
_ambientSoundSystem.SetAmbience(uid, removed.TotalMoles > 0f); | ||
} | ||
} | ||
|
||
private void OnPumpLeaveAtmosphere(EntityUid uid, GasPressurePumpComponent pump, ref AtmosDeviceDisabledEvent args) | ||
{ | ||
pump.Enabled = false; | ||
UpdateAppearance(uid, pump); | ||
|
||
DirtyUI(uid, pump); | ||
_userInterfaceSystem.CloseUi(uid, GasPressurePumpUiKey.Key); | ||
} | ||
|
||
private void OnPumpActivate(EntityUid uid, GasPressurePumpComponent pump, ActivateInWorldEvent args) | ||
{ | ||
if (args.Handled || !args.Complex) | ||
return; | ||
|
||
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) | ||
return; | ||
[UsedImplicitly] | ||
public sealed class GasPressurePumpSystem : SharedGasPressurePumpSystem | ||
{ | ||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; | ||
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; | ||
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!; | ||
|
||
if (Transform(uid).Anchored) | ||
{ | ||
_userInterfaceSystem.OpenUi(uid, GasPressurePumpUiKey.Key, actor.PlayerSession); | ||
DirtyUI(uid, pump); | ||
} | ||
else | ||
{ | ||
_popup.PopupCursor(Loc.GetString("comp-gas-pump-ui-needs-anchor"), args.User); | ||
} | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
args.Handled = true; | ||
} | ||
SubscribeLocalEvent<GasPressurePumpComponent, AtmosDeviceUpdateEvent>(OnPumpUpdated); | ||
} | ||
|
||
private void OnToggleStatusMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpToggleStatusMessage args) | ||
private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, ref AtmosDeviceUpdateEvent args) | ||
{ | ||
if (!pump.Enabled | ||
|| (TryComp<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered) | ||
|| !_nodeContainer.TryGetNodes(uid, pump.InletName, pump.OutletName, out PipeNode? inlet, out PipeNode? outlet)) | ||
{ | ||
pump.Enabled = args.Enabled; | ||
_adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium, | ||
$"{ToPrettyString(args.Actor):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); | ||
DirtyUI(uid, pump); | ||
UpdateAppearance(uid, pump); | ||
_ambientSoundSystem.SetAmbience(uid, false); | ||
return; | ||
} | ||
|
||
private void OnOutputPressureChangeMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpChangeOutputPressureMessage args) | ||
{ | ||
pump.TargetPressure = Math.Clamp(args.Pressure, 0f, Atmospherics.MaxOutputPressure); | ||
_adminLogger.Add(LogType.AtmosPressureChanged, LogImpact.Medium, | ||
$"{ToPrettyString(args.Actor):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa"); | ||
DirtyUI(uid, pump); | ||
|
||
} | ||
var outputStartingPressure = outlet.Air.Pressure; | ||
|
||
private void DirtyUI(EntityUid uid, GasPressurePumpComponent? pump) | ||
if (outputStartingPressure >= pump.TargetPressure) | ||
{ | ||
if (!Resolve(uid, ref pump)) | ||
return; | ||
|
||
_userInterfaceSystem.SetUiState(uid, GasPressurePumpUiKey.Key, | ||
new GasPressurePumpBoundUserInterfaceState(EntityManager.GetComponent<MetaDataComponent>(uid).EntityName, pump.TargetPressure, pump.Enabled)); | ||
_ambientSoundSystem.SetAmbience(uid, false); | ||
return; // No need to pump gas if target has been reached. | ||
} | ||
|
||
private void UpdateAppearance(EntityUid uid, GasPressurePumpComponent? pump = null, AppearanceComponent? appearance = null) | ||
if (inlet.Air.TotalMoles > 0 && inlet.Air.Temperature > 0) | ||
{ | ||
if (!Resolve(uid, ref pump, ref appearance, false)) | ||
return; | ||
// We calculate the necessary moles to transfer using our good ol' friend PV=nRT. | ||
var pressureDelta = pump.TargetPressure - outputStartingPressure; | ||
var transferMoles = (pressureDelta * outlet.Air.Volume) / (inlet.Air.Temperature * Atmospherics.R); | ||
|
||
bool pumpOn = pump.Enabled && (TryComp<ApcPowerReceiverComponent>(uid, out var power) && power.Powered); | ||
_appearance.SetData(uid, PumpVisuals.Enabled, pumpOn, appearance); | ||
var removed = inlet.Air.Remove(transferMoles); | ||
_atmosphereSystem.Merge(outlet.Air, removed); | ||
_ambientSoundSystem.SetAmbience(uid, removed.TotalMoles > 0f); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 15 additions & 41 deletions
56
Content.Shared/Atmos/Piping/Binary/Components/SharedGasPressurePumpComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,21 @@ | ||
using Robust.Shared.Serialization; | ||
|
||
namespace Content.Shared.Atmos.Piping.Binary.Components | ||
{ | ||
[Serializable, NetSerializable] | ||
public enum GasPressurePumpUiKey | ||
{ | ||
Key, | ||
} | ||
|
||
[Serializable, NetSerializable] | ||
public sealed class GasPressurePumpBoundUserInterfaceState : BoundUserInterfaceState | ||
{ | ||
public string PumpLabel { get; } | ||
public float OutputPressure { get; } | ||
public bool Enabled { get; } | ||
|
||
public GasPressurePumpBoundUserInterfaceState(string pumpLabel, float outputPressure, bool enabled) | ||
{ | ||
PumpLabel = pumpLabel; | ||
OutputPressure = outputPressure; | ||
Enabled = enabled; | ||
} | ||
} | ||
namespace Content.Shared.Atmos.Piping.Binary.Components; | ||
|
||
[Serializable, NetSerializable] | ||
public sealed class GasPressurePumpToggleStatusMessage : BoundUserInterfaceMessage | ||
{ | ||
public bool Enabled { get; } | ||
|
||
public GasPressurePumpToggleStatusMessage(bool enabled) | ||
{ | ||
Enabled = enabled; | ||
} | ||
} | ||
[Serializable, NetSerializable] | ||
public enum GasPressurePumpUiKey : byte | ||
{ | ||
Key, | ||
} | ||
|
||
[Serializable, NetSerializable] | ||
public sealed class GasPressurePumpChangeOutputPressureMessage : BoundUserInterfaceMessage | ||
{ | ||
public float Pressure { get; } | ||
[Serializable, NetSerializable] | ||
public sealed class GasPressurePumpToggleStatusMessage(bool enabled) : BoundUserInterfaceMessage | ||
{ | ||
public bool Enabled { get; } = enabled; | ||
} | ||
|
||
public GasPressurePumpChangeOutputPressureMessage(float pressure) | ||
{ | ||
Pressure = pressure; | ||
} | ||
} | ||
[Serializable, NetSerializable] | ||
public sealed class GasPressurePumpChangeOutputPressureMessage(float pressure) : BoundUserInterfaceMessage | ||
{ | ||
public float Pressure { get; } = pressure; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,137 @@ | ||
using Content.Shared.Alert; | ||
using Content.Shared.FixedPoint; | ||
using Robust.Shared.GameStates; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Generic; | ||
|
||
namespace Content.Shared.Backmen.Mood; | ||
|
||
/// <summary> | ||
/// This component exists solely to network CurrentMoodLevel, so that clients can make use of its value for math Prediction. | ||
/// All mood logic is otherwise handled by the Server, and the client is not allowed to know the identity of its mood events. | ||
/// </summary> | ||
[RegisterComponent, AutoGenerateComponentState] | ||
public sealed partial class NetMoodComponent : Component | ||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] | ||
public sealed partial class MoodComponent : Component | ||
{ | ||
public override bool SendOnlyToOwner => true; | ||
|
||
[DataField, AutoNetworkedField] | ||
public float CurrentMoodLevel; | ||
|
||
[DataField, AutoNetworkedField] | ||
public float NeutralMoodThreshold; | ||
|
||
[DataField] | ||
public MoodThreshold CurrentMoodThreshold; | ||
|
||
[DataField] | ||
public MoodThreshold LastThreshold; | ||
|
||
[ViewVariables(VVAccess.ReadOnly)] | ||
public readonly Dictionary<string, string> CategorisedEffects = new(); | ||
|
||
[ViewVariables(VVAccess.ReadOnly)] | ||
public readonly Dictionary<string, float> UncategorisedEffects = new(); | ||
|
||
/// <summary> | ||
/// The formula for the movement speed modifier is SpeedBonusGrowth ^ (MoodLevel - MoodThreshold.Neutral). | ||
/// Change this ONLY BY 0.001 AT A TIME. | ||
/// </summary> | ||
[DataField] | ||
public float SpeedBonusGrowth = 1.003f; | ||
|
||
/// <summary> | ||
/// The lowest point that low morale can multiply our movement speed by. Lowering speed follows a linear curve, rather than geometric. | ||
/// </summary> | ||
[DataField] | ||
public float MinimumSpeedModifier = 0.90f; | ||
|
||
/// <summary> | ||
/// The maximum amount that high morale can multiply our movement speed by. This follows a significantly slower geometric sequence. | ||
/// </summary> | ||
[DataField] | ||
public float MaximumSpeedModifier = 1.15f; | ||
|
||
[DataField] | ||
public float IncreaseCritThreshold = 1.2f; | ||
|
||
[DataField] | ||
public float DecreaseCritThreshold = 0.9f; | ||
|
||
/// <summary> | ||
/// Multiplier for positive mood effects. | ||
/// </summary> | ||
[DataField] | ||
public float GoodMoodMultiplier = 1.0f; | ||
|
||
/// <summary> | ||
/// Multiplier for negative mood effects. | ||
/// </summary> | ||
[DataField] | ||
public float BadMoodMultiplier = 1.0f; | ||
|
||
[DataField] | ||
public MoodThreshold BuffsMoodThreshold = MoodThreshold.Good; | ||
|
||
[DataField] | ||
public MoodThreshold ConsMoodThreshold = MoodThreshold.Bad; | ||
|
||
[ViewVariables(VVAccess.ReadOnly)] | ||
public FixedPoint2 CritThresholdBeforeModify; | ||
|
||
[DataField(customTypeSerializer: typeof(DictionarySerializer<MoodThreshold, float>))] | ||
public Dictionary<MoodThreshold, float> MoodThresholds = new() | ||
{ | ||
{ MoodThreshold.Perfect, 100f }, | ||
{ MoodThreshold.Exceptional, 80f }, | ||
{ MoodThreshold.Great, 70f }, | ||
{ MoodThreshold.Good, 60f }, | ||
{ MoodThreshold.Neutral, 50f }, | ||
{ MoodThreshold.Meh, 40f }, | ||
{ MoodThreshold.Bad, 30f }, | ||
{ MoodThreshold.Terrible, 20f }, | ||
{ MoodThreshold.Horrible, 10f }, | ||
{ MoodThreshold.Dead, 0f } | ||
}; | ||
|
||
[DataField(customTypeSerializer: typeof(DictionarySerializer<MoodThreshold, ProtoId<AlertPrototype>>))] | ||
public Dictionary<MoodThreshold, ProtoId<AlertPrototype>> MoodThresholdsAlerts = new() | ||
{ | ||
{ MoodThreshold.Dead, "MoodDead" }, | ||
{ MoodThreshold.Horrible, "MoodHorrible" }, | ||
{ MoodThreshold.Terrible, "MoodTerrible" }, | ||
{ MoodThreshold.Bad, "MoodBad" }, | ||
{ MoodThreshold.Meh, "MoodMeh" }, | ||
{ MoodThreshold.Neutral, "MoodNeutral" }, | ||
{ MoodThreshold.Good, "MoodGood" }, | ||
{ MoodThreshold.Great, "MoodGreat" }, | ||
{ MoodThreshold.Exceptional, "MoodExceptional" }, | ||
{ MoodThreshold.Perfect, "MoodPerfect" }, | ||
{ MoodThreshold.Insane, "MoodInsane" } | ||
}; | ||
|
||
/// <summary> | ||
/// These thresholds represent a percentage of Crit-Threshold, 0.8 corresponding with 80%. | ||
/// </summary> | ||
[DataField(customTypeSerializer: typeof(DictionarySerializer<string, float>))] | ||
public Dictionary<string, float> HealthMoodEffectsThresholds = new() | ||
{ | ||
{ "HealthHeavyDamage", 0.8f }, | ||
{ "HealthSevereDamage", 0.5f }, | ||
{ "HealthOkayDamage", 0.35f }, | ||
{ "HealthLightDamage", 0.1f }, | ||
{ "HealthNoDamage", 0.05f } | ||
}; | ||
} | ||
|
||
[Serializable] | ||
public enum MoodThreshold : ushort | ||
{ | ||
Insane = 1, | ||
Horrible = 2, | ||
Terrible = 3, | ||
Bad = 4, | ||
Meh = 5, | ||
Neutral = 6, | ||
Good = 7, | ||
Great = 8, | ||
Exceptional = 9, | ||
Perfect = 10, | ||
Dead = 0 | ||
} |
This file was deleted.
Oops, something went wrong.
76 changes: 0 additions & 76 deletions
76
Content.Shared/Backmen/OfferItem/SharedOfferItemSystem.Interactions.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.