Enable nullability in Content.Client (#3257)
* Enable nullability in Content.Client * Remove #nullable enable * Merge fixes * Remove Debug.Assert * Merge fixes * Fix build * Fix build
This commit is contained in:
@@ -15,14 +15,13 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
{
|
||||
}
|
||||
|
||||
private IdCardConsoleWindow _window;
|
||||
private IdCardConsoleWindow? _window;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new IdCardConsoleWindow(this, _prototypeManager);
|
||||
_window.Title = Owner.Owner.Name;
|
||||
_window = new IdCardConsoleWindow(this, _prototypeManager) {Title = Owner.Owner.Name};
|
||||
_window.OnClose += Close;
|
||||
_window.OpenCentered();
|
||||
}
|
||||
@@ -31,7 +30,7 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
{
|
||||
base.UpdateState(state);
|
||||
var castState = (IdCardConsoleBoundUserInterfaceState) state;
|
||||
_window.UpdateState(castState);
|
||||
_window?.UpdateState(castState);
|
||||
}
|
||||
|
||||
public void ButtonPressed(UiButton button)
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
|
||||
private readonly Dictionary<string, Button> _accessButtons = new();
|
||||
|
||||
private string _lastFullName;
|
||||
private string _lastJobTitle;
|
||||
private string? _lastFullName;
|
||||
private string? _lastJobTitle;
|
||||
|
||||
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeManager prototypeManager)
|
||||
{
|
||||
@@ -165,7 +165,7 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
_fullNameLineEdit.Editable = interfaceEnabled;
|
||||
if (!fullNameDirty)
|
||||
{
|
||||
_fullNameLineEdit.Text = state.TargetIdFullName;
|
||||
_fullNameLineEdit.Text = state.TargetIdFullName ?? "";
|
||||
}
|
||||
|
||||
_fullNameSaveButton.Disabled = !interfaceEnabled || !fullNameDirty;
|
||||
@@ -174,7 +174,7 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
_jobTitleLineEdit.Editable = interfaceEnabled;
|
||||
if (!jobTitleDirty)
|
||||
{
|
||||
_jobTitleLineEdit.Text = state.TargetIdJobTitle;
|
||||
_jobTitleLineEdit.Text = state.TargetIdJobTitle ?? "";
|
||||
}
|
||||
|
||||
_jobTitleSaveButton.Disabled = !interfaceEnabled || !jobTitleDirty;
|
||||
@@ -184,7 +184,7 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
button.Disabled = !interfaceEnabled;
|
||||
if (interfaceEnabled)
|
||||
{
|
||||
button.Pressed = state.TargetIdAccessList.Contains(accessName);
|
||||
button.Pressed = state.TargetIdAccessList?.Contains(accessName) ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.ActionBlocking;
|
||||
using Content.Shared.GameObjects.Components.ActionBlocking;
|
||||
using Content.Shared.Preferences.Appearance;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.ActionBlocking;
|
||||
using Content.Shared.GameObjects.Components.ActionBlocking;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using Content.Client.GameObjects.Components.Mobs;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
@@ -91,7 +90,7 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
}
|
||||
});
|
||||
|
||||
AddChild(new Placeholder(resourceCache)
|
||||
AddChild(new Placeholder()
|
||||
{
|
||||
PlaceholderText = Loc.GetString("Health & status effects")
|
||||
});
|
||||
@@ -104,7 +103,7 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
ObjectivesContainer = new VBoxContainer();
|
||||
AddChild(ObjectivesContainer);
|
||||
|
||||
AddChild(new Placeholder(resourceCache)
|
||||
AddChild(new Placeholder()
|
||||
{
|
||||
PlaceholderText = Loc.GetString("Antagonist Roles")
|
||||
});
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
/// <remarks>
|
||||
/// Null if it would otherwise be empty.
|
||||
/// </remarks>
|
||||
public SS14Window Window { get; private set; }
|
||||
public CharacterWindow? Window { get; private set; }
|
||||
|
||||
private List<ICharacterUI> _uiComponents;
|
||||
private List<ICharacterUI>? _uiComponents;
|
||||
|
||||
/// <summary>
|
||||
/// Create the window with all character UIs and bind it to a keypress
|
||||
@@ -58,10 +58,13 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
{
|
||||
base.OnRemove();
|
||||
|
||||
foreach (var component in _uiComponents)
|
||||
if (_uiComponents != null)
|
||||
{
|
||||
// Make sure these don't get deleted when the window is disposed.
|
||||
component.Scene.Orphan();
|
||||
foreach (var component in _uiComponents)
|
||||
{
|
||||
// Make sure these don't get deleted when the window is disposed.
|
||||
component.Scene.Orphan();
|
||||
}
|
||||
}
|
||||
|
||||
_uiComponents = null;
|
||||
@@ -73,7 +76,7 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
inputMgr.SetInputCommand(ContentKeyFunctions.OpenCharacterMenu, null);
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent component)
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Client.Arcade;
|
||||
using Content.Shared.Arcade;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -8,9 +7,9 @@ namespace Content.Client.GameObjects.Components.Arcade
|
||||
{
|
||||
public class BlockGameBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
private BlockGameMenu _menu;
|
||||
private BlockGameMenu? _menu;
|
||||
|
||||
public BlockGameBoundUserInterface([NotNull] ClientUserInterfaceComponent owner, [NotNull] object uiKey) : base(owner, uiKey)
|
||||
public BlockGameBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
using Content.Client.Arcade;
|
||||
using Content.Shared.GameObjects.Components.Arcade;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using static Content.Shared.GameObjects.Components.Arcade.SharedSpaceVillainArcadeComponent;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Arcade
|
||||
{
|
||||
public class SpaceVillainArcadeBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables] private SpaceVillainArcadeMenu _menu;
|
||||
[ViewVariables] private SpaceVillainArcadeMenu? _menu;
|
||||
|
||||
//public SharedSpaceVillainArcadeComponent SpaceVillainArcade;
|
||||
|
||||
public SpaceVillainArcadeBoundUserInterface([NotNull] ClientUserInterfaceComponent owner, [NotNull] object uiKey) : base(owner, uiKey)
|
||||
public SpaceVillainArcadeBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
SendAction(SharedSpaceVillainArcadeComponent.PlayerAction.RequestData);
|
||||
SendAction(PlayerAction.RequestData);
|
||||
}
|
||||
|
||||
public void SendAction(SharedSpaceVillainArcadeComponent.PlayerAction action)
|
||||
public void SendAction(PlayerAction action)
|
||||
{
|
||||
SendMessage(new SharedSpaceVillainArcadeComponent.SpaceVillainArcadePlayerActionMessage(action));
|
||||
SendMessage(new SpaceVillainArcadePlayerActionMessage(action));
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
@@ -42,16 +41,14 @@ namespace Content.Client.GameObjects.Components.Arcade
|
||||
|
||||
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
|
||||
{
|
||||
if(message is SharedSpaceVillainArcadeComponent.SpaceVillainArcadeDataUpdateMessage msg) _menu.UpdateInfo(msg);
|
||||
if (message is SpaceVillainArcadeDataUpdateMessage msg) _menu?.UpdateInfo(msg);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if (!disposing)
|
||||
return;
|
||||
|
||||
_menu?.Dispose();
|
||||
if (disposing) _menu?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
@@ -13,12 +11,15 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
[DataField("fireStackAlternateState")]
|
||||
private int _fireStackAlternateState = 3;
|
||||
|
||||
[DataField("normalState")]
|
||||
private string _normalState;
|
||||
private string? _normalState;
|
||||
|
||||
[DataField("alternateState")]
|
||||
private string _alternateState;
|
||||
private string? _alternateState;
|
||||
|
||||
[DataField("sprite")]
|
||||
private string _sprite;
|
||||
private string? _sprite;
|
||||
|
||||
public override void InitializeEntity(IEntity entity)
|
||||
{
|
||||
@@ -49,7 +50,11 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||
|
||||
sprite.LayerSetRSI(FireVisualLayers.Fire, _sprite);
|
||||
if (_sprite != null)
|
||||
{
|
||||
sprite.LayerSetRSI(FireVisualLayers.Fire, _sprite);
|
||||
}
|
||||
|
||||
sprite.LayerSetVisible(FireVisualLayers.Fire, onFire);
|
||||
|
||||
if(fireStacks > _fireStackAlternateState && !string.IsNullOrEmpty(_alternateState))
|
||||
|
||||
@@ -10,13 +10,13 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
}
|
||||
|
||||
private GasAnalyzerWindow _menu;
|
||||
private GasAnalyzerWindow? _menu;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
_menu = new GasAnalyzerWindow(this);
|
||||
|
||||
_menu = new GasAnalyzerWindow(this);
|
||||
_menu.OnClose += Close;
|
||||
_menu.OpenCentered();
|
||||
}
|
||||
@@ -24,7 +24,8 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
_menu.Populate((GasAnalyzerBoundUserInterfaceState) state);
|
||||
|
||||
_menu?.Populate((GasAnalyzerBoundUserInterfaceState) state);
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
@@ -35,10 +36,8 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if (!disposing)
|
||||
return;
|
||||
|
||||
_menu?.Dispose();
|
||||
if (disposing) _menu?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Content.Client.Utility;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Client.UserInterface;
|
||||
@@ -22,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
return new StatusControl(this);
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
if (curState is not GasAnalyzerComponentState state)
|
||||
return;
|
||||
@@ -55,15 +54,17 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
}
|
||||
|
||||
_parent._uiUpdateNeeded = false;
|
||||
|
||||
var color = _parent.Danger switch
|
||||
{
|
||||
GasAnalyzerDanger.Warning => "orange",
|
||||
GasAnalyzerDanger.Hazard => "red",
|
||||
_ => "green",
|
||||
};
|
||||
|
||||
_label.SetMarkup(Loc.GetString("Pressure: [color={0}]{1}[/color]",
|
||||
color,
|
||||
Enum.GetName(typeof(GasAnalyzerDanger), _parent.Danger)));
|
||||
_parent.Danger));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
@@ -11,9 +9,9 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
public class GasAnalyzerVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("state_off")]
|
||||
private string _stateOff;
|
||||
private string? _stateOff;
|
||||
[DataField("state_working")]
|
||||
private string _stateWorking;
|
||||
private string? _stateWorking;
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
@@ -24,7 +22,7 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
return;
|
||||
}
|
||||
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -39,8 +37,6 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
case GasAnalyzerVisualState.Working:
|
||||
sprite.LayerSetState(0, _stateWorking);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
@@ -2,15 +2,14 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
public class GasCanisterVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("stateConnected")]
|
||||
private string _stateConnected;
|
||||
private string? _stateConnected;
|
||||
|
||||
[DataField("pressureStates")]
|
||||
private string[] _statePressure = new string[] {"", "", "", ""};
|
||||
|
||||
@@ -20,11 +19,14 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
|
||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
||||
|
||||
sprite.LayerMapSet(Layers.ConnectedToPort, sprite.AddLayerState(_stateConnected));
|
||||
sprite.LayerSetVisible(Layers.ConnectedToPort, false);
|
||||
if (_stateConnected != null)
|
||||
{
|
||||
sprite.LayerMapSet(Layers.ConnectedToPort, sprite.AddLayerState(_stateConnected));
|
||||
sprite.LayerSetVisible(Layers.ConnectedToPort, false);
|
||||
|
||||
sprite.LayerMapSet(Layers.PressureLight, sprite.AddLayerState(_stateConnected));
|
||||
sprite.LayerSetShader(Layers.PressureLight, "unshaded");
|
||||
sprite.LayerMapSet(Layers.PressureLight, sprite.AddLayerState(_stateConnected));
|
||||
sprite.LayerSetShader(Layers.PressureLight, "unshaded");
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
@@ -36,7 +38,7 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
return;
|
||||
}
|
||||
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
@@ -49,7 +49,7 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
Children =
|
||||
{
|
||||
new Label(){ Text = Loc.GetString("Label: ") },
|
||||
(LabelInput = new LineEdit() { Text = Name, Editable = false,
|
||||
(LabelInput = new LineEdit() { Text = Name ?? "", Editable = false,
|
||||
MinSize = new Vector2(200, 30)}),
|
||||
(EditLabelBtn = new Button()),
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
|
||||
if (!entity.TryGetComponent(out ISpriteComponent sprite)) return;
|
||||
if (!entity.TryGetComponent(out ISpriteComponent? sprite)) return;
|
||||
|
||||
sprite.LayerMapReserveBlank(Layer.PumpEnabled);
|
||||
var pumpEnabledLayer = sprite.LayerMapGet(Layer.PumpEnabled);
|
||||
@@ -27,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite)) return;
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) return;
|
||||
if (!component.TryGetData(PumpVisuals.VisualState, out PumpVisualState pumpVisualState)) return;
|
||||
|
||||
var pumpEnabledLayer = sprite.LayerMapGet(Layer.PumpEnabled);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
|
||||
if (!entity.TryGetComponent(out ISpriteComponent sprite)) return;
|
||||
if (!entity.TryGetComponent(out ISpriteComponent? sprite)) return;
|
||||
|
||||
sprite.LayerMapReserveBlank(Layer.SiphonEnabled);
|
||||
var layer = sprite.LayerMapGet(Layer.SiphonEnabled);
|
||||
@@ -27,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite)) return;
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) return;
|
||||
if (!component.TryGetData(SiphonVisuals.VisualState, out SiphonVisualState siphonVisualState)) return;
|
||||
|
||||
var layer = sprite.LayerMapGet(Layer.SiphonEnabled);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
|
||||
if (!entity.TryGetComponent(out ISpriteComponent sprite)) return;
|
||||
if (!entity.TryGetComponent(out ISpriteComponent? sprite)) return;
|
||||
|
||||
sprite.LayerMapReserveBlank(Layer.VentEnabled);
|
||||
var layer = sprite.LayerMapGet(Layer.VentEnabled);
|
||||
@@ -27,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite)) return;
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) return;
|
||||
if (!component.TryGetData(VentVisuals.VisualState, out VentVisualState ventVisualState)) return;
|
||||
|
||||
var layer = sprite.LayerMapGet(Layer.VentEnabled);
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
[DataField("animation_state")]
|
||||
private string _state = "chempuff";
|
||||
|
||||
private Animation VaporFlick;
|
||||
private Animation VaporFlick = default!;
|
||||
|
||||
void ISerializationHooks.AfterDeserialization()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Body.Mechanism
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Body.Part
|
||||
|
||||
@@ -11,10 +11,10 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
|
||||
public class BodyScannerBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private BodyScannerDisplay _display;
|
||||
private BodyScannerDisplay? _display;
|
||||
|
||||
[ViewVariables]
|
||||
private IEntity _entity;
|
||||
private IEntity? _entity;
|
||||
|
||||
public BodyScannerBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { }
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
|
||||
throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner.Uid} at {Owner.Owner.Transform.MapPosition}");
|
||||
}
|
||||
|
||||
_display.UpdateDisplay(_entity);
|
||||
_display?.UpdateDisplay(_entity);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Body.Surgery;
|
||||
using Content.Shared.GameObjects.Components.Body.Surgery;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
|
||||
public delegate void OptionSelectedCallback(int selectedOptionData);
|
||||
|
||||
private readonly VBoxContainer _optionsBox;
|
||||
private OptionSelectedCallback _optionSelectedCallback;
|
||||
private OptionSelectedCallback? _optionSelectedCallback;
|
||||
|
||||
public SurgeryWindow()
|
||||
{
|
||||
@@ -65,7 +65,7 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
|
||||
{
|
||||
if (args.Button.Parent is SurgeryButton surgery)
|
||||
{
|
||||
_optionSelectedCallback(surgery.CallbackData);
|
||||
_optionSelectedCallback?.Invoke(surgery.CallbackData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Client.GameObjects.Components.Buckle
|
||||
{
|
||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||
|
||||
if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent animation))
|
||||
if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent? animation))
|
||||
{
|
||||
sprite.Rotation = rotation;
|
||||
return;
|
||||
|
||||
@@ -2,35 +2,43 @@
|
||||
using Content.Shared.GameObjects.Components.Cargo;
|
||||
using Content.Shared.Prototypes.Cargo;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using static Content.Shared.GameObjects.Components.Cargo.SharedCargoConsoleComponent;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Cargo
|
||||
{
|
||||
public class CargoConsoleBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private CargoConsoleMenu _menu;
|
||||
[ViewVariables]
|
||||
private CargoConsoleOrderMenu _orderMenu;
|
||||
private CargoConsoleMenu? _menu;
|
||||
|
||||
[ViewVariables]
|
||||
public GalacticMarketComponent Market { get; private set; }
|
||||
private CargoConsoleOrderMenu? _orderMenu;
|
||||
|
||||
[ViewVariables]
|
||||
public CargoOrderDatabaseComponent Orders { get; private set; }
|
||||
public GalacticMarketComponent? Market { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public CargoOrderDatabaseComponent? Orders { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public bool RequestOnly { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public int BankId { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public string BankName { get; private set; }
|
||||
public string? BankName { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public int BankBalance { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public (int CurrentCapacity, int MaxCapacity) ShuttleCapacity { get; private set; }
|
||||
|
||||
private CargoProductPrototype _product;
|
||||
private CargoProductPrototype? _product;
|
||||
|
||||
public CargoConsoleBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
@@ -40,8 +48,8 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
{
|
||||
base.Open();
|
||||
|
||||
if (!Owner.Owner.TryGetComponent(out GalacticMarketComponent market)
|
||||
|| !Owner.Owner.TryGetComponent(out CargoOrderDatabaseComponent orders)) return;
|
||||
if (!Owner.Owner.TryGetComponent(out GalacticMarketComponent? market) ||
|
||||
!Owner.Owner.TryGetComponent(out CargoOrderDatabaseComponent? orders)) return;
|
||||
|
||||
Market = market;
|
||||
Orders = orders;
|
||||
@@ -57,23 +65,23 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
Market.OnDatabaseUpdated += _menu.PopulateCategories;
|
||||
Orders.OnDatabaseUpdated += _menu.PopulateOrders;
|
||||
|
||||
_menu.CallShuttleButton.OnPressed += (args) =>
|
||||
_menu.CallShuttleButton.OnPressed += (_) =>
|
||||
{
|
||||
SendMessage(new SharedCargoConsoleComponent.CargoConsoleShuttleMessage());
|
||||
SendMessage(new CargoConsoleShuttleMessage());
|
||||
};
|
||||
_menu.OnItemSelected += (args) =>
|
||||
{
|
||||
if (args.Button.Parent is not CargoProductRow row)
|
||||
return;
|
||||
_product = row.Product;
|
||||
_orderMenu.Requester.Text = null;
|
||||
_orderMenu.Reason.Text = null;
|
||||
_orderMenu.Requester.Text = "";
|
||||
_orderMenu.Reason.Text = "";
|
||||
_orderMenu.Amount.Value = 1;
|
||||
_orderMenu.OpenCentered();
|
||||
};
|
||||
_menu.OnOrderApproved += ApproveOrder;
|
||||
_menu.OnOrderCanceled += RemoveOrder;
|
||||
_orderMenu.SubmitButton.OnPressed += (args) =>
|
||||
_orderMenu.SubmitButton.OnPressed += (_) =>
|
||||
{
|
||||
AddOrder();
|
||||
_orderMenu.Close();
|
||||
@@ -92,47 +100,63 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
if (RequestOnly != cState.RequestOnly)
|
||||
{
|
||||
RequestOnly = cState.RequestOnly;
|
||||
_menu.UpdateRequestOnly();
|
||||
_menu?.UpdateRequestOnly();
|
||||
}
|
||||
BankId = cState.BankId;
|
||||
BankName = cState.BankName;
|
||||
BankBalance = cState.BankBalance;
|
||||
ShuttleCapacity = cState.ShuttleCapacity;
|
||||
_menu.UpdateCargoCapacity();
|
||||
_menu.UpdateBankData();
|
||||
_menu?.UpdateCargoCapacity();
|
||||
_menu?.UpdateBankData();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
if (!disposing) return;
|
||||
Market.OnDatabaseUpdated -= _menu.PopulateProducts;
|
||||
Market.OnDatabaseUpdated -= _menu.PopulateCategories;
|
||||
Orders.OnDatabaseUpdated -= _menu.PopulateOrders;
|
||||
|
||||
if (Market != null && _menu != null)
|
||||
{
|
||||
Market.OnDatabaseUpdated -= _menu.PopulateProducts;
|
||||
Market.OnDatabaseUpdated -= _menu.PopulateCategories;
|
||||
}
|
||||
|
||||
if (Orders != null && _menu != null)
|
||||
{
|
||||
Orders.OnDatabaseUpdated -= _menu.PopulateOrders;
|
||||
}
|
||||
|
||||
_menu?.Dispose();
|
||||
_orderMenu?.Dispose();
|
||||
}
|
||||
|
||||
internal void AddOrder()
|
||||
private void AddOrder()
|
||||
{
|
||||
SendMessage(new SharedCargoConsoleComponent.CargoConsoleAddOrderMessage(_orderMenu.Requester.Text,
|
||||
_orderMenu.Reason.Text, _product.ID, _orderMenu.Amount.Value));
|
||||
SendMessage(new CargoConsoleAddOrderMessage(
|
||||
_orderMenu?.Requester.Text ?? "",
|
||||
_orderMenu?.Reason.Text ?? "",
|
||||
_product?.ID ?? "",
|
||||
_orderMenu?.Amount.Value ?? 0));
|
||||
}
|
||||
|
||||
internal void RemoveOrder(BaseButton.ButtonEventArgs args)
|
||||
private void RemoveOrder(ButtonEventArgs args)
|
||||
{
|
||||
if (args.Button.Parent.Parent is not CargoOrderRow row)
|
||||
if (args.Button.Parent?.Parent is not CargoOrderRow row || row.Order == null)
|
||||
return;
|
||||
SendMessage(new SharedCargoConsoleComponent.CargoConsoleRemoveOrderMessage(row.Order.OrderNumber));
|
||||
|
||||
SendMessage(new CargoConsoleRemoveOrderMessage(row.Order.OrderNumber));
|
||||
}
|
||||
|
||||
internal void ApproveOrder(BaseButton.ButtonEventArgs args)
|
||||
private void ApproveOrder(ButtonEventArgs args)
|
||||
{
|
||||
if (args.Button.Parent.Parent is not CargoOrderRow row)
|
||||
if (args.Button.Parent?.Parent is not CargoOrderRow row || row.Order == null)
|
||||
return;
|
||||
|
||||
if (ShuttleCapacity.CurrentCapacity == ShuttleCapacity.MaxCapacity)
|
||||
return;
|
||||
SendMessage(new SharedCargoConsoleComponent.CargoConsoleApproveOrderMessage(row.Order.OrderNumber));
|
||||
|
||||
SendMessage(new CargoConsoleApproveOrderMessage(row.Order.OrderNumber));
|
||||
_menu?.UpdateCargoCapacity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
/// <summary>
|
||||
/// Event called when the database is updated.
|
||||
/// </summary>
|
||||
public event Action OnDatabaseUpdated;
|
||||
public event Action? OnDatabaseUpdated;
|
||||
|
||||
// TODO add account selector menu
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
_orders.Add(order);
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
if (curState is not CargoOrderDatabaseState state)
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
/// <summary>
|
||||
/// Event called when the database is updated.
|
||||
/// </summary>
|
||||
public event Action OnDatabaseUpdated;
|
||||
public event Action? OnDatabaseUpdated;
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
if (curState is not GalacticMarketState state)
|
||||
@@ -25,7 +25,7 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
_productIds.Clear();
|
||||
foreach (var productId in state.Products)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex(productId, out CargoProductPrototype product))
|
||||
if (!_prototypeManager.TryIndex(productId, out CargoProductPrototype? product))
|
||||
continue;
|
||||
_products.Add(product);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
@@ -13,6 +13,7 @@ using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using static Content.Shared.GameObjects.Components.Chemistry.ChemMaster.SharedChemMasterComponent;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
|
||||
{
|
||||
@@ -38,7 +39,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
|
||||
|
||||
public bool BufferModeTransfer = true;
|
||||
|
||||
public event Action<BaseButton.ButtonEventArgs, ChemButton> OnChemButtonPressed;
|
||||
public event Action<ButtonEventArgs, ChemButton>? OnChemButtonPressed;
|
||||
|
||||
public HBoxContainer PillInfo { get; set; }
|
||||
public HBoxContainer BottleInfo { get; set; }
|
||||
@@ -331,7 +332,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
|
||||
{
|
||||
var name = Loc.GetString("Unknown reagent");
|
||||
//Try to the prototype for the given reagent. This gives us it's name.
|
||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
|
||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype? proto))
|
||||
{
|
||||
name = proto.Name;
|
||||
}
|
||||
@@ -386,7 +387,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
|
||||
{
|
||||
var name = Loc.GetString("Unknown reagent");
|
||||
//Try to the prototype for the given reagent. This gives us it's name.
|
||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
|
||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype? proto))
|
||||
{
|
||||
name = proto.Name;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Animations;
|
||||
|
||||
@@ -9,8 +9,6 @@ using Robust.Shared.Localization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Chemistry
|
||||
{
|
||||
[RegisterComponent]
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Chemistry
|
||||
void IItemStatus.DestroyControl(Control control) { }
|
||||
|
||||
//Handle net updates
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
if (curState is not InjectorComponentState state)
|
||||
{
|
||||
|
||||
@@ -16,12 +16,11 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
|
||||
[UsedImplicitly]
|
||||
public class ReagentDispenserBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
private ReagentDispenserWindow _window;
|
||||
private ReagentDispenserBoundUserInterfaceState _lastState;
|
||||
private ReagentDispenserWindow? _window;
|
||||
private ReagentDispenserBoundUserInterfaceState? _lastState;
|
||||
|
||||
public ReagentDispenserBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -80,8 +79,14 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
|
||||
/// <param name="inventory">A list of the reagents which can be dispensed.</param>
|
||||
private void UpdateReagentsList(List<ReagentDispenserInventoryEntry> inventory)
|
||||
{
|
||||
if (_window == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_window.UpdateReagentsList(inventory);
|
||||
for (int i = 0; i < _window.ChemicalList.Children.Count(); i++)
|
||||
|
||||
for (var i = 0; i < _window.ChemicalList.Children.Count(); i++)
|
||||
{
|
||||
var button = (Button)_window.ChemicalList.Children.ElementAt(i);
|
||||
var i1 = i;
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
|
||||
|
||||
foreach (var entry in inventory)
|
||||
{
|
||||
if (_prototypeManager.TryIndex(entry.ID, out ReagentPrototype proto))
|
||||
if (_prototypeManager.TryIndex(entry.ID, out ReagentPrototype? proto))
|
||||
{
|
||||
ChemicalList.AddChild(new Button {Text = proto.Name});
|
||||
}
|
||||
@@ -253,8 +253,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
|
||||
/// </summary>
|
||||
/// <param name="state">State data for the dispenser.</param>
|
||||
/// <param name="highlightedReagentId">Prototype id of the reagent whose dispense button is currently being mouse hovered.</param>
|
||||
public void UpdateContainerInfo(ReagentDispenserBoundUserInterfaceState state,
|
||||
string highlightedReagentId = null)
|
||||
public void UpdateContainerInfo(ReagentDispenserBoundUserInterfaceState state, string highlightedReagentId = "")
|
||||
{
|
||||
ContainerInfo.Children.Clear();
|
||||
|
||||
@@ -286,7 +285,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
|
||||
{
|
||||
var name = Loc.GetString("Unknown reagent");
|
||||
//Try to the prototype for the given reagent. This gives us it's name.
|
||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
|
||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype? proto))
|
||||
{
|
||||
name = proto.Name;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Client.GameObjects.Components.CloningPod
|
||||
{
|
||||
}
|
||||
|
||||
private CloningPodWindow _window;
|
||||
private CloningPodWindow? _window;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
@@ -39,7 +39,8 @@ namespace Content.Client.GameObjects.Components.CloningPod
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
_window.Populate((CloningPodBoundUserInterfaceState) state);
|
||||
|
||||
_window?.Populate((CloningPodBoundUserInterfaceState) state);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Client.GameObjects.Components.HUD.Inventory;
|
||||
using Content.Client.GameObjects.Components.HUD.Inventory;
|
||||
using Content.Client.GameObjects.Components.Items;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
@@ -70,6 +69,12 @@ namespace Content.Client.GameObjects.Components.Clothing
|
||||
}
|
||||
|
||||
var rsi = GetRSI();
|
||||
|
||||
if (rsi == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var prefix = ClothingEquippedPrefix ?? EquippedPrefix;
|
||||
var stateId = prefix != null ? $"{prefix}-equipped-{slot}" : $"equipped-{slot}";
|
||||
if (rsi.TryGetState(stateId, out _))
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System;
|
||||
using Content.Client.Command;
|
||||
using Content.Shared.GameObjects.Components.Command;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
@@ -4,17 +4,17 @@ using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using static Content.Shared.GameObjects.Components.SharedConfigurationComponent;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Wires
|
||||
namespace Content.Client.GameObjects.Components.Configuration
|
||||
{
|
||||
public class ConfigurationBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
public Regex Validation { get; internal set; }
|
||||
public Regex? Validation { get; internal set; }
|
||||
|
||||
public ConfigurationBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
private ConfigurationMenu _menu;
|
||||
private ConfigurationMenu? _menu;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
@@ -28,12 +28,19 @@ namespace Content.Client.GameObjects.Components.Wires
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
_menu.Populate(state as ConfigurationBoundUserInterfaceState);
|
||||
|
||||
if (state is not ConfigurationBoundUserInterfaceState configurationState)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_menu?.Populate(configurationState);
|
||||
}
|
||||
|
||||
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
|
||||
{
|
||||
base.ReceiveMessage(message);
|
||||
|
||||
if (message is ValidationUpdateMessage msg)
|
||||
{
|
||||
Validation = new Regex(msg.ValidationString, RegexOptions.Compiled);
|
||||
@@ -49,8 +56,11 @@ namespace Content.Client.GameObjects.Components.Wires
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
_menu.OnClose -= Close;
|
||||
_menu.Close();
|
||||
if (disposing && _menu != null)
|
||||
{
|
||||
_menu.OnClose -= Close;
|
||||
_menu.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using Robust.Shared.Maths;
|
||||
using static Content.Shared.GameObjects.Components.SharedConfigurationComponent;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Wires
|
||||
namespace Content.Client.GameObjects.Components.Configuration
|
||||
{
|
||||
public class ConfigurationMenu : SS14Window
|
||||
{
|
||||
|
||||
@@ -16,14 +16,16 @@ namespace Content.Client.GameObjects.Components.Construction
|
||||
|
||||
public override string Name => "ConstructionGhost";
|
||||
|
||||
[ViewVariables] public ConstructionPrototype Prototype { get; set; }
|
||||
[ViewVariables] public int GhostID { get; set; }
|
||||
[ViewVariables] public ConstructionPrototype? Prototype { get; set; }
|
||||
[ViewVariables] public int GhostId { get; set; }
|
||||
|
||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
if (Prototype == null) return;
|
||||
|
||||
message.AddMarkup(Loc.GetString("Building: [color=cyan]{0}[/color]\n", Prototype.Name));
|
||||
|
||||
if (!_prototypeManager.TryIndex(Prototype.Graph, out ConstructionGraphPrototype graph)) return;
|
||||
if (!_prototypeManager.TryIndex(Prototype.Graph, out ConstructionGraphPrototype? graph)) return;
|
||||
var startNode = graph.Nodes[Prototype.StartNode];
|
||||
var path = graph.Path(Prototype.StartNode, Prototype.TargetNode);
|
||||
var edge = startNode.GetEdge(path[0].Name);
|
||||
|
||||
@@ -4,8 +4,6 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Conveyor
|
||||
{
|
||||
@@ -13,15 +11,17 @@ namespace Content.Client.GameObjects.Components.Conveyor
|
||||
public class ConveyorVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("state_running")]
|
||||
private string _stateRunning;
|
||||
private string? _stateRunning;
|
||||
|
||||
[DataField("state_stopped")]
|
||||
private string _stateStopped;
|
||||
private string? _stateStopped;
|
||||
|
||||
[DataField("state_reversed")]
|
||||
private string _stateReversed;
|
||||
private string? _stateReversed;
|
||||
|
||||
private void ChangeState(AppearanceComponent appearance)
|
||||
{
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Conveyor
|
||||
{
|
||||
@@ -12,15 +10,17 @@ namespace Content.Client.GameObjects.Components.Conveyor
|
||||
public class TwoWayLeverVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("state_forward")]
|
||||
private string _stateForward;
|
||||
private string? _stateForward;
|
||||
|
||||
[DataField("state_off")]
|
||||
private string _stateOff;
|
||||
private string? _stateOff;
|
||||
|
||||
[DataField("state_reversed")]
|
||||
private string _stateReversed;
|
||||
private string? _stateReversed;
|
||||
|
||||
private void ChangeState(AppearanceComponent appearance)
|
||||
{
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Crayon
|
||||
{
|
||||
@@ -13,7 +13,7 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
{
|
||||
}
|
||||
|
||||
private CrayonWindow _menu;
|
||||
private CrayonWindow? _menu;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
@@ -31,7 +31,8 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
_menu.UpdateState((CrayonBoundUserInterfaceState) state);
|
||||
|
||||
_menu?.UpdateState((CrayonBoundUserInterfaceState) state);
|
||||
}
|
||||
|
||||
public void Select(string state)
|
||||
@@ -43,7 +44,10 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
_menu.Close();
|
||||
if (disposing)
|
||||
{
|
||||
_menu?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
return new StatusControl(this);
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
if (curState is not CrayonComponentState state)
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
@@ -7,7 +8,7 @@ using Robust.Client.Utility;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Collections.Generic;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Crayon
|
||||
{
|
||||
@@ -16,8 +17,8 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
public CrayonBoundUserInterface Owner { get; }
|
||||
private readonly LineEdit _search;
|
||||
private readonly GridContainer _grid;
|
||||
private Dictionary<string, Texture> _decals;
|
||||
private string _selected;
|
||||
private Dictionary<string, Texture>? _decals;
|
||||
private string? _selected;
|
||||
private Color _color;
|
||||
|
||||
public CrayonWindow(CrayonBoundUserInterface owner)
|
||||
@@ -30,7 +31,7 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
Contents.AddChild(vbox);
|
||||
|
||||
_search = new LineEdit();
|
||||
_search.OnTextChanged += (e) => RefreshList();
|
||||
_search.OnTextChanged += (_) => RefreshList();
|
||||
vbox.AddChild(_search);
|
||||
|
||||
_grid = new GridContainer()
|
||||
@@ -68,7 +69,7 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
ToolTip = decal,
|
||||
Modulate = _color
|
||||
};
|
||||
button.OnPressed += Button_OnPressed;
|
||||
button.OnPressed += ButtonOnPressed;
|
||||
if (_selected == decal)
|
||||
{
|
||||
var panelContainer = new PanelContainer()
|
||||
@@ -91,11 +92,14 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_OnPressed(BaseButton.ButtonEventArgs obj)
|
||||
private void ButtonOnPressed(ButtonEventArgs obj)
|
||||
{
|
||||
Owner.Select(obj.Button.Name);
|
||||
_selected = obj.Button.Name;
|
||||
RefreshList();
|
||||
if (obj.Button.Name != null)
|
||||
{
|
||||
Owner.Select(obj.Button.Name);
|
||||
_selected = obj.Button.Name;
|
||||
RefreshList();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateState(CrayonBoundUserInterfaceState state)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalRouterComponent;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalTaggerComponent;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalUnitComponent;
|
||||
|
||||
@@ -15,36 +15,36 @@ namespace Content.Client.GameObjects.Components.Disposal
|
||||
private const string AnimationKey = "disposal_unit_animation";
|
||||
|
||||
[DataField("state_anchored", required: true)]
|
||||
private string _stateAnchored;
|
||||
private string? _stateAnchored;
|
||||
|
||||
[DataField("state_unanchored", required: true)]
|
||||
private string _stateUnAnchored;
|
||||
private string? _stateUnAnchored;
|
||||
|
||||
[DataField("state_charging", required: true)]
|
||||
private string _stateCharging;
|
||||
private string? _stateCharging;
|
||||
|
||||
[DataField("overlay_charging", required: true)]
|
||||
private string _overlayCharging;
|
||||
private string? _overlayCharging;
|
||||
|
||||
[DataField("overlay_ready", required: true)]
|
||||
private string _overlayReady;
|
||||
private string? _overlayReady;
|
||||
|
||||
[DataField("overlay_full", required: true)]
|
||||
private string _overlayFull;
|
||||
private string? _overlayFull;
|
||||
|
||||
[DataField("overlay_engaged", required: true)]
|
||||
private string _overlayEngaged;
|
||||
private string? _overlayEngaged;
|
||||
|
||||
[DataField("state_flush", required: true)]
|
||||
private string _stateFlush;
|
||||
private string? _stateFlush;
|
||||
|
||||
[DataField("flush_sound", required: true)]
|
||||
private string _flushSound;
|
||||
private string? _flushSound;
|
||||
|
||||
[DataField("flush_time", required: true)]
|
||||
private float _flushTime;
|
||||
|
||||
private Animation _flushAnimation;
|
||||
private Animation _flushAnimation = default!;
|
||||
|
||||
void ISerializationHooks.AfterDeserialization()
|
||||
{
|
||||
@@ -57,7 +57,11 @@ namespace Content.Client.GameObjects.Components.Disposal
|
||||
|
||||
var sound = new AnimationTrackPlaySound();
|
||||
_flushAnimation.AnimationTracks.Add(sound);
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_flushSound, 0));
|
||||
|
||||
if (_flushSound != null)
|
||||
{
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_flushSound, 0));
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeState(AppearanceComponent appearance)
|
||||
@@ -67,7 +71,7 @@ namespace Content.Client.GameObjects.Components.Disposal
|
||||
return;
|
||||
}
|
||||
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Disposal
|
||||
{
|
||||
@@ -13,15 +11,17 @@ namespace Content.Client.GameObjects.Components.Disposal
|
||||
public class DisposalVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("state_free")]
|
||||
private string _stateFree;
|
||||
private string? _stateFree;
|
||||
|
||||
[DataField("state_anchored")]
|
||||
private string _stateAnchored;
|
||||
private string? _stateAnchored;
|
||||
|
||||
[DataField("state_broken")]
|
||||
private string _stateBroken;
|
||||
private string? _stateBroken;
|
||||
|
||||
private void ChangeState(AppearanceComponent appearance)
|
||||
{
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.GameObjects.EntitySystems.DoAfter;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Client.GameObjects.Components.Wires;
|
||||
using Content.Shared.Audio;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Doors;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Doors
|
||||
{
|
||||
|
||||
@@ -2,8 +2,6 @@ using Content.Shared.GameObjects.Components.Explosion;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Explosion
|
||||
{
|
||||
@@ -12,7 +10,7 @@ namespace Content.Client.GameObjects.Components.Explosion
|
||||
public class ClusterFlashVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("state")]
|
||||
private string _state;
|
||||
private string? _state;
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
|
||||
@@ -53,9 +53,8 @@ namespace Content.Client.GameObjects.Components
|
||||
}
|
||||
};
|
||||
|
||||
private Action<string> _radiatingCallback;
|
||||
private Action<string> _blinkingCallback;
|
||||
|
||||
private Action<string>? _radiatingCallback;
|
||||
private Action<string>? _blinkingCallback;
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Fluids
|
||||
{
|
||||
@@ -11,9 +9,9 @@ namespace Content.Client.GameObjects.Components.Fluids
|
||||
public class SprayVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("safety_on_state")]
|
||||
private string _safetyOnState;
|
||||
private string? _safetyOnState;
|
||||
[DataField("safety_off_state")]
|
||||
private string _safetyOffState;
|
||||
private string? _safetyOffState;
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components.Gravity;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
@@ -9,9 +10,10 @@ using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Gravity
|
||||
{
|
||||
public class GravityGeneratorBoundUserInterface: BoundUserInterface
|
||||
[UsedImplicitly]
|
||||
public class GravityGeneratorBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
private GravityGeneratorWindow _window;
|
||||
private GravityGeneratorWindow? _window;
|
||||
|
||||
public bool IsOn;
|
||||
|
||||
@@ -28,7 +30,7 @@ namespace Content.Client.GameObjects.Components.Gravity
|
||||
|
||||
_window = new GravityGeneratorWindow(this);
|
||||
|
||||
_window.Switch.OnPressed += (args) =>
|
||||
_window.Switch.OnPressed += (_) =>
|
||||
{
|
||||
SendMessage(new SharedGravityGeneratorComponent.SwitchGeneratorMessage(!IsOn));
|
||||
SendMessage(new SharedGravityGeneratorComponent.GeneratorStatusRequestMessage());
|
||||
@@ -43,7 +45,7 @@ namespace Content.Client.GameObjects.Components.Gravity
|
||||
|
||||
var castState = (SharedGravityGeneratorComponent.GeneratorState) state;
|
||||
IsOn = castState.On;
|
||||
_window.UpdateButton();
|
||||
_window?.UpdateButton();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
@@ -63,11 +65,11 @@ namespace Content.Client.GameObjects.Components.Gravity
|
||||
|
||||
public GravityGeneratorBoundUserInterface Owner;
|
||||
|
||||
public GravityGeneratorWindow(GravityGeneratorBoundUserInterface gravityGeneratorInterface = null)
|
||||
public GravityGeneratorWindow(GravityGeneratorBoundUserInterface ui)
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
Owner = gravityGeneratorInterface;
|
||||
Owner = ui;
|
||||
|
||||
Title = Loc.GetString("Gravity Generator Control");
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.Components.Clothing;
|
||||
@@ -268,7 +267,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetSlot(Slots slot, out IEntity? item)
|
||||
public bool TryGetSlot(Slots slot, [NotNullWhen(true)] out IEntity? item)
|
||||
{
|
||||
return _slots.TryGetValue(slot, out item);
|
||||
}
|
||||
|
||||
@@ -25,13 +25,13 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
private readonly Dictionary<Slots, List<ItemSlotButton>> _inventoryButtons
|
||||
= new();
|
||||
|
||||
private ItemSlotButton _hudButtonPocket1;
|
||||
private ItemSlotButton _hudButtonPocket2;
|
||||
private ItemSlotButton _hudButtonBelt;
|
||||
private ItemSlotButton _hudButtonBack;
|
||||
private ItemSlotButton _hudButtonId;
|
||||
private Control _rightQuickButtonsContainer;
|
||||
private Control _leftQuickButtonsContainer;
|
||||
private ItemSlotButton _hudButtonPocket1 = default!;
|
||||
private ItemSlotButton _hudButtonPocket2 = default!;
|
||||
private ItemSlotButton _hudButtonBelt = default!;
|
||||
private ItemSlotButton _hudButtonBack = default!;
|
||||
private ItemSlotButton _hudButtonId = default!;
|
||||
private Control _rightQuickButtonsContainer = default!;
|
||||
private Control _leftQuickButtonsContainer = default!;
|
||||
|
||||
public HumanInventoryInterfaceController(ClientInventoryComponent owner) : base(owner)
|
||||
{
|
||||
@@ -47,7 +47,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
{
|
||||
button.OnPressed = (e) => AddToInventory(e, slot);
|
||||
button.OnStoragePressed = (e) => OpenStorage(e, slot);
|
||||
button.OnHover = (e) => RequestItemHover(slot);
|
||||
button.OnHover = (_) => RequestItemHover(slot);
|
||||
_inventoryButtons.Add(slot, new List<ItemSlotButton> {button});
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
{
|
||||
OnPressed = (e) => AddToInventory(e, slot),
|
||||
OnStoragePressed = (e) => OpenStorage(e, slot),
|
||||
OnHover = (e) => RequestItemHover(slot)
|
||||
OnHover = (_) => RequestItemHover(slot)
|
||||
};
|
||||
_inventoryButtons[slot].Add(variable);
|
||||
}
|
||||
@@ -93,8 +93,8 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
};
|
||||
}
|
||||
|
||||
public override SS14Window Window => _window;
|
||||
private HumanInventoryWindow _window;
|
||||
public override SS14Window? Window => _window;
|
||||
private HumanInventoryWindow? _window;
|
||||
|
||||
public override IEnumerable<ItemSlotButton> GetItemSlotButtons(Slots slot)
|
||||
{
|
||||
@@ -152,7 +152,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
|
||||
protected override void HandleInventoryKeybind(GUIBoundKeyEventArgs args, Slots slot)
|
||||
{
|
||||
if (!_inventoryButtons.TryGetValue(slot, out var buttons))
|
||||
if (!_inventoryButtons.ContainsKey(slot))
|
||||
return;
|
||||
if (!Owner.TryGetSlot(slot, out var item))
|
||||
return;
|
||||
|
||||
@@ -22,10 +22,9 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
|
||||
public virtual void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public abstract SS14Window Window { get; }
|
||||
public abstract SS14Window? Window { get; }
|
||||
protected ClientInventoryComponent Owner { get; }
|
||||
|
||||
public virtual void PlayerAttached()
|
||||
@@ -35,11 +34,11 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
Window.Open();
|
||||
Window?.Open();
|
||||
}
|
||||
else
|
||||
{
|
||||
Window.Close();
|
||||
Window?.Close();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -47,7 +46,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
public virtual void PlayerDetached()
|
||||
{
|
||||
GameHud.InventoryButtonVisible = false;
|
||||
Window.Close();
|
||||
Window?.Close();
|
||||
}
|
||||
|
||||
public virtual void Dispose()
|
||||
|
||||
@@ -13,12 +13,12 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
[UsedImplicitly]
|
||||
public class StrippableBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
public Dictionary<Slots, string> Inventory { get; private set; }
|
||||
public Dictionary<string, string> Hands { get; private set; }
|
||||
public Dictionary<EntityUid, string> Handcuffs { get; private set; }
|
||||
public Dictionary<Slots, string>? Inventory { get; private set; }
|
||||
public Dictionary<string, string>? Hands { get; private set; }
|
||||
public Dictionary<EntityUid, string>? Handcuffs { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
private StrippingMenu _strippingMenu;
|
||||
private StrippingMenu? _strippingMenu;
|
||||
|
||||
public StrippableBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
if (!disposing)
|
||||
return;
|
||||
|
||||
_strippingMenu.Dispose();
|
||||
_strippingMenu?.Dispose();
|
||||
}
|
||||
|
||||
private void UpdateMenu()
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components
|
||||
return new StatusControl(this);
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
|
||||
@@ -40,12 +40,12 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
private float _timer;
|
||||
|
||||
private static readonly StyleBoxFlat _styleBoxLit = new()
|
||||
private static readonly StyleBoxFlat StyleBoxLit = new()
|
||||
{
|
||||
BackgroundColor = Color.Green
|
||||
};
|
||||
|
||||
private static readonly StyleBoxFlat _styleBoxUnlit = new()
|
||||
private static readonly StyleBoxFlat StyleBoxUnlit = new()
|
||||
{
|
||||
BackgroundColor = Color.Black
|
||||
};
|
||||
@@ -88,22 +88,22 @@ namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
if (level == 0)
|
||||
{
|
||||
_sections[0].PanelOverride = _styleBoxUnlit;
|
||||
_sections[0].PanelOverride = StyleBoxUnlit;
|
||||
}
|
||||
else if (level == 1)
|
||||
{
|
||||
// Flash the last light.
|
||||
_sections[0].PanelOverride = _timer > TimerCycle / 2 ? _styleBoxLit : _styleBoxUnlit;
|
||||
_sections[0].PanelOverride = _timer > TimerCycle / 2 ? StyleBoxLit : StyleBoxUnlit;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sections[0].PanelOverride = _styleBoxLit;
|
||||
_sections[0].PanelOverride = StyleBoxLit;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
_sections[i].PanelOverride = level >= i + 2 ? _styleBoxLit : _styleBoxUnlit;
|
||||
_sections[i].PanelOverride = level >= i + 2 ? StyleBoxLit : StyleBoxUnlit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using static Robust.Client.GameObjects.SpriteComponent;
|
||||
|
||||
@@ -27,28 +25,28 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
[RegisterComponent]
|
||||
public class IconSmoothComponent : Component
|
||||
{
|
||||
[DataField("key")]
|
||||
private string _smoothKey = default;
|
||||
[DataField("base")]
|
||||
private string _stateBase = "";
|
||||
[DataField("mode")]
|
||||
private IconSmoothingMode _mode = IconSmoothingMode.Corners;
|
||||
|
||||
public override string Name => "IconSmooth";
|
||||
|
||||
internal ISpriteComponent Sprite { get; private set; }
|
||||
internal SnapGridComponent SnapGrid { get; private set; }
|
||||
internal ISpriteComponent? Sprite { get; private set; }
|
||||
|
||||
internal SnapGridComponent? SnapGrid { get; private set; }
|
||||
|
||||
private (GridId, Vector2i) _lastPosition;
|
||||
|
||||
/// <summary>
|
||||
/// We will smooth with other objects with the same key.
|
||||
/// </summary>
|
||||
public string SmoothKey => _smoothKey;
|
||||
[field: DataField("key")]
|
||||
public string? SmoothKey { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Prepended to the RSI state.
|
||||
/// </summary>
|
||||
public string StateBase => _stateBase;
|
||||
[field: DataField("base")]
|
||||
public string StateBase { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Mode that controls how the icon should be selected.
|
||||
@@ -73,12 +71,18 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
{
|
||||
base.Startup();
|
||||
|
||||
SnapGrid.OnPositionChanged += SnapGridOnPositionChanged;
|
||||
// ensures lastposition initial value is populated on spawn. Just calling
|
||||
// the hook here would cause a dirty event to fire needlessly
|
||||
_lastPosition = (Owner.Transform.GridID, SnapGrid.Position);
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner,null, SnapGrid.Offset, Mode));
|
||||
if (Mode == IconSmoothingMode.Corners)
|
||||
if (SnapGrid != null)
|
||||
{
|
||||
SnapGrid.OnPositionChanged += SnapGridOnPositionChanged;
|
||||
|
||||
// ensures lastposition initial value is populated on spawn. Just calling
|
||||
// the hook here would cause a dirty event to fire needlessly
|
||||
_lastPosition = (Owner.Transform.GridID, SnapGrid.Position);
|
||||
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner,null, SnapGrid.Offset, Mode));
|
||||
}
|
||||
|
||||
if (Sprite != null && Mode == IconSmoothingMode.Corners)
|
||||
{
|
||||
var state0 = $"{StateBase}0";
|
||||
Sprite.LayerMapSet(CornerLayers.SE, Sprite.AddLayerState(state0));
|
||||
@@ -111,6 +115,11 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
|
||||
private void CalculateNewSpriteCardinal()
|
||||
{
|
||||
if (SnapGrid == null || Sprite == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var dirs = CardinalConnectDirs.None;
|
||||
|
||||
if (MatchingEntity(SnapGrid.GetInDir(Direction.North)))
|
||||
@@ -127,6 +136,11 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
|
||||
private void CalculateNewSpriteCorners()
|
||||
{
|
||||
if (Sprite == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var (cornerNE, cornerNW, cornerSW, cornerSE) = CalculateCornerFill();
|
||||
|
||||
Sprite.LayerSetState(CornerLayers.NE, $"{StateBase}{(int) cornerNE}");
|
||||
@@ -137,6 +151,11 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
|
||||
protected (CornerFill ne, CornerFill nw, CornerFill sw, CornerFill se) CalculateCornerFill()
|
||||
{
|
||||
if (SnapGrid == null)
|
||||
{
|
||||
return (CornerFill.None, CornerFill.None, CornerFill.None, CornerFill.None);
|
||||
}
|
||||
|
||||
var n = MatchingEntity(SnapGrid.GetInDir(Direction.North));
|
||||
var ne = MatchingEntity(SnapGrid.GetInDir(Direction.NorthEast));
|
||||
var e = MatchingEntity(SnapGrid.GetInDir(Direction.East));
|
||||
@@ -215,14 +234,20 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
SnapGrid.OnPositionChanged -= SnapGridOnPositionChanged;
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, SnapGrid.Offset, Mode));
|
||||
if (SnapGrid != null)
|
||||
{
|
||||
SnapGrid.OnPositionChanged -= SnapGridOnPositionChanged;
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, SnapGrid.Offset, Mode));
|
||||
}
|
||||
}
|
||||
|
||||
private void SnapGridOnPositionChanged()
|
||||
{
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, SnapGrid.Offset, Mode));
|
||||
_lastPosition = (Owner.Transform.GridID, SnapGrid.Position);
|
||||
if (SnapGrid != null)
|
||||
{
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, SnapGrid.Offset, Mode));
|
||||
_lastPosition = (Owner.Transform.GridID, SnapGrid.Position);
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.Contracts.Pure]
|
||||
@@ -230,7 +255,7 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
{
|
||||
foreach (var entity in candidates)
|
||||
{
|
||||
if (!entity.TryGetComponent(out IconSmoothComponent other))
|
||||
if (!entity.TryGetComponent(out IconSmoothComponent? other))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace Content.Client.GameObjects.Components.Instruments
|
||||
public class InstrumentBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private InstrumentMenu _instrumentMenu;
|
||||
private InstrumentMenu? _instrumentMenu;
|
||||
|
||||
public InstrumentComponent Instrument { get; set; }
|
||||
public InstrumentComponent? Instrument { get; set; }
|
||||
|
||||
public InstrumentBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -5,8 +5,6 @@ using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -27,7 +25,7 @@ namespace Content.Client.GameObjects.Components.Interactable
|
||||
public override string Name => "MultiTool";
|
||||
public override uint? NetID => ContentNetIDs.MULTITOOLS;
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -26,7 +25,7 @@ namespace Content.Client.GameObjects.Components.Interactable
|
||||
[ViewVariables] public bool Activated { get; private set; }
|
||||
[ViewVariables] public override ToolQuality Qualities => _behavior;
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
public override string Name => "InteractionOutline";
|
||||
|
||||
private ShaderInstance _selectionShaderInstance;
|
||||
private ShaderInstance _selectionShaderInRangeInstance;
|
||||
private ShaderInstance? _selectionShaderInstance;
|
||||
private ShaderInstance? _selectionShaderInRangeInstance;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize()
|
||||
@@ -30,7 +30,7 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
public void OnMouseEnter(bool inInteractionRange)
|
||||
{
|
||||
if (Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
sprite.PostShader = inInteractionRange ? _selectionShaderInRangeInstance : _selectionShaderInstance;
|
||||
sprite.RenderOrder = Owner.EntityManager.CurrentTick.Value;
|
||||
@@ -39,7 +39,7 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
public void OnMouseLeave()
|
||||
{
|
||||
if (Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
sprite.PostShader = null;
|
||||
sprite.RenderOrder = 0;
|
||||
@@ -48,7 +48,7 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
public void UpdateInRange(bool inInteractionRange)
|
||||
{
|
||||
if (Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
sprite.PostShader = inInteractionRange ? _selectionShaderInRangeInstance : _selectionShaderInstance;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
|
||||
@@ -8,8 +8,6 @@ using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -27,38 +25,43 @@ namespace Content.Client.GameObjects.Components.Items
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("sprite")]
|
||||
protected ResourcePath RsiPath;
|
||||
protected ResourcePath? RsiPath;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("color")]
|
||||
protected Color Color = Color.White;
|
||||
|
||||
[DataField("HeldPrefix")]
|
||||
private string _equippedPrefix;
|
||||
private string? _equippedPrefix;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string EquippedPrefix
|
||||
public string? EquippedPrefix
|
||||
{
|
||||
get => _equippedPrefix;
|
||||
set
|
||||
{
|
||||
_equippedPrefix = value;
|
||||
if (!Owner.TryGetContainer(out IContainer container)) return;
|
||||
if(container.Owner.TryGetComponent(out HandsComponent hands))
|
||||
|
||||
if (!Owner.TryGetContainer(out var container))
|
||||
return;
|
||||
|
||||
if (container.Owner.TryGetComponent(out HandsComponent? hands))
|
||||
hands.RefreshInHands();
|
||||
}
|
||||
}
|
||||
|
||||
public (RSI rsi, RSI.StateId stateId, Color color)? GetInHandStateInfo(HandLocation hand)
|
||||
{
|
||||
if (RsiPath == null)
|
||||
var rsi = GetRSI();
|
||||
|
||||
if (rsi == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var handName = hand.ToString().ToLowerInvariant();
|
||||
var rsi = GetRSI();
|
||||
var stateId = EquippedPrefix != null ? $"{EquippedPrefix}-inhand-{handName}" : $"inhand-{handName}";
|
||||
|
||||
if (rsi.TryGetState(stateId, out _))
|
||||
{
|
||||
return (rsi, stateId, Color);
|
||||
@@ -67,18 +70,22 @@ namespace Content.Client.GameObjects.Components.Items
|
||||
return null;
|
||||
}
|
||||
|
||||
protected RSI GetRSI()
|
||||
protected RSI? GetRSI()
|
||||
{
|
||||
if (RsiPath == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _resourceCache.GetResource<RSIResource>(SharedSpriteComponent.TextureRoot / RsiPath).RSI;
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
if(curState == null)
|
||||
if (curState is not ItemComponentState state)
|
||||
return;
|
||||
|
||||
var itemComponentState = (ItemComponentState)curState;
|
||||
EquippedPrefix = itemComponentState.EquippedPrefix;
|
||||
EquippedPrefix = state.EquippedPrefix;
|
||||
}
|
||||
|
||||
bool IDraggable.CanDrop(CanDropEventArgs args)
|
||||
|
||||
@@ -13,6 +13,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Kitchen
|
||||
{
|
||||
@@ -22,7 +23,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
private MicrowaveMenu _menu;
|
||||
private MicrowaveMenu? _menu;
|
||||
|
||||
private readonly Dictionary<int, EntityUid> _solids = new();
|
||||
private readonly Dictionary<int, Solution.ReagentQuantity> _reagents =new();
|
||||
@@ -38,8 +39,8 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
_menu = new MicrowaveMenu(this);
|
||||
_menu.OpenCentered();
|
||||
_menu.OnClose += Close;
|
||||
_menu.StartButton.OnPressed += args => SendMessage(new SharedMicrowaveComponent.MicrowaveStartCookMessage());
|
||||
_menu.EjectButton.OnPressed += args => SendMessage(new SharedMicrowaveComponent.MicrowaveEjectMessage());
|
||||
_menu.StartButton.OnPressed += _ => SendMessage(new SharedMicrowaveComponent.MicrowaveStartCookMessage());
|
||||
_menu.EjectButton.OnPressed += _ => SendMessage(new SharedMicrowaveComponent.MicrowaveEjectMessage());
|
||||
_menu.IngredientsList.OnItemSelected += args =>
|
||||
{
|
||||
SendMessage(new SharedMicrowaveComponent.MicrowaveEjectSolidIndexedMessage(_solids[args.ItemIndex]));
|
||||
@@ -55,20 +56,20 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
_menu.OnCookTimeSelected += (args,buttonIndex) =>
|
||||
{
|
||||
var actualButton = (MicrowaveMenu.MicrowaveCookTimeButton) args.Button ;
|
||||
var newTime = actualButton.CookTime;
|
||||
SendMessage(new SharedMicrowaveComponent.MicrowaveSelectCookTimeMessage(buttonIndex,actualButton.CookTime));
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
if (!disposing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_solids?.Clear();
|
||||
|
||||
_solids.Clear();
|
||||
_menu?.Dispose();
|
||||
}
|
||||
|
||||
@@ -80,24 +81,34 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
{
|
||||
return;
|
||||
}
|
||||
_menu.ToggleBusyDisableOverlayPanel(cState.IsMicrowaveBusy);
|
||||
|
||||
_menu?.ToggleBusyDisableOverlayPanel(cState.IsMicrowaveBusy);
|
||||
RefreshContentsDisplay(cState.ReagentQuantities, cState.ContainedSolids);
|
||||
var currentlySelectedTimeButton = (Button) _menu.CookTimeButtonVbox.GetChild(cState.ActiveButtonIndex);
|
||||
currentlySelectedTimeButton.Pressed = true;
|
||||
var label = cState.ActiveButtonIndex <= 0 ? Loc.GetString("INSTANT") : cState.CurrentCookTime.ToString();
|
||||
_menu._cookTimeInfoLabel.Text = $"{Loc.GetString("COOK TIME")}: {label}";
|
||||
|
||||
if (_menu != null)
|
||||
{
|
||||
var currentlySelectedTimeButton = (Button) _menu.CookTimeButtonVbox.GetChild(cState.ActiveButtonIndex);
|
||||
currentlySelectedTimeButton.Pressed = true;
|
||||
var label = cState.ActiveButtonIndex <= 0 ? Loc.GetString("INSTANT") : cState.CurrentCookTime.ToString();
|
||||
_menu._cookTimeInfoLabel.Text = $"{Loc.GetString("COOK TIME")}: {label}";
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshContentsDisplay(Solution.ReagentQuantity[] reagents, EntityUid[] containedSolids)
|
||||
{
|
||||
_reagents.Clear();
|
||||
|
||||
if (_menu == null) return;
|
||||
|
||||
_menu.IngredientsListReagents.Clear();
|
||||
for (var i = 0; i < reagents.Length; i++)
|
||||
{
|
||||
_prototypeManager.TryIndex(reagents[i].ReagentId, out ReagentPrototype proto);
|
||||
var reagentAdded = _menu.IngredientsListReagents.AddItem($"{reagents[i].Quantity} {proto.Name}");
|
||||
var reagentIndex = _menu.IngredientsListReagents.IndexOf(reagentAdded);
|
||||
_reagents.Add(reagentIndex, reagents[i]);
|
||||
if (_prototypeManager.TryIndex(reagents[i].ReagentId, out ReagentPrototype? proto))
|
||||
{
|
||||
var reagentAdded = _menu.IngredientsListReagents.AddItem($"{reagents[i].Quantity} {proto.Name}");
|
||||
var reagentIndex = _menu.IngredientsListReagents.IndexOf(reagentAdded);
|
||||
_reagents.Add(reagentIndex, reagents[i]);
|
||||
}
|
||||
}
|
||||
|
||||
_solids.Clear();
|
||||
@@ -108,31 +119,34 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity.Deleted)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Texture texture;
|
||||
if (entity.TryGetComponent(out IconComponent iconComponent))
|
||||
Texture? texture;
|
||||
if (entity.TryGetComponent(out IconComponent? iconComponent))
|
||||
{
|
||||
texture = iconComponent.Icon?.Default;
|
||||
}else if (entity.TryGetComponent(out SpriteComponent spriteComponent))
|
||||
}
|
||||
else if (entity.TryGetComponent(out SpriteComponent? spriteComponent))
|
||||
{
|
||||
texture = spriteComponent.Icon?.Default;
|
||||
}else{continue;}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var solidItem = _menu.IngredientsList.AddItem(entity.Name, texture);
|
||||
var solidIndex = _menu.IngredientsList.IndexOf(solidItem);
|
||||
_solids.Add(solidIndex, containedSolids[j]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class MicrowaveMenu : SS14Window
|
||||
{
|
||||
|
||||
public class MicrowaveCookTimeButton : Button
|
||||
{
|
||||
public uint CookTime;
|
||||
@@ -141,7 +155,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
|
||||
private MicrowaveBoundUserInterface Owner { get; set; }
|
||||
|
||||
public event Action<BaseButton.ButtonEventArgs, int> OnCookTimeSelected;
|
||||
public event Action<ButtonEventArgs, int>? OnCookTimeSelected;
|
||||
|
||||
public Button StartButton { get; }
|
||||
public Button EjectButton { get; }
|
||||
@@ -149,19 +163,19 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
public PanelContainer TimerFacePlate { get; }
|
||||
|
||||
public ButtonGroup CookTimeButtonGroup { get; }
|
||||
|
||||
public VBoxContainer CookTimeButtonVbox { get; }
|
||||
|
||||
private VBoxContainer ButtonGridContainer { get; }
|
||||
|
||||
private PanelContainer DisableCookingPanelOverlay { get; }
|
||||
|
||||
|
||||
public ItemList IngredientsList { get; }
|
||||
|
||||
public ItemList IngredientsListReagents { get; }
|
||||
public Label _cookTimeInfoLabel { get; }
|
||||
|
||||
public MicrowaveMenu(MicrowaveBoundUserInterface owner = null)
|
||||
public MicrowaveMenu(MicrowaveBoundUserInterface owner)
|
||||
{
|
||||
SetSize = MinSize = (512, 256);
|
||||
|
||||
@@ -246,7 +260,6 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
Align = BoxContainer.AlignMode.Center,
|
||||
};
|
||||
|
||||
|
||||
var index = 0;
|
||||
for (var i = 0; i <= 6; i++)
|
||||
{
|
||||
@@ -270,7 +283,6 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
var cookTimeOneSecondButton = (Button) CookTimeButtonVbox.GetChild(0);
|
||||
cookTimeOneSecondButton.Pressed = true;
|
||||
|
||||
|
||||
_cookTimeInfoLabel = new Label
|
||||
{
|
||||
Text = Loc.GetString("COOK TIME: 1"),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Client.GameObjects.Components.Sound;
|
||||
using Content.Client.GameObjects.Components.Sound;
|
||||
using Content.Shared.GameObjects.Components.Power;
|
||||
using Content.Shared.GameObjects.Components.Sound;
|
||||
using Content.Shared.Kitchen;
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Kitchen;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Content.Shared.Kitchen;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Content.Shared.Chemistry;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Client.GameObjects;
|
||||
using static Content.Shared.Chemistry.Solution;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Kitchen
|
||||
{
|
||||
@@ -18,14 +19,16 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
private GrinderMenu _menu;
|
||||
private Dictionary<int, EntityUid> _chamberVisualContents = new();
|
||||
private Dictionary<int, Solution.ReagentQuantity> _beakerVisualContents = new();
|
||||
private GrinderMenu? _menu;
|
||||
private readonly Dictionary<int, EntityUid> _chamberVisualContents = new();
|
||||
private readonly Dictionary<int, ReagentQuantity> _beakerVisualContents = new();
|
||||
|
||||
public ReagentGrinderBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { }
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_menu = new GrinderMenu(this);
|
||||
_menu.OpenCentered();
|
||||
_menu.OnClose += Close;
|
||||
@@ -64,6 +67,12 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_menu == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_menu.BeakerContentBox.EjectButton.Disabled = !cState.HasBeakerIn;
|
||||
_menu.ChamberContentBox.EjectButton.Disabled = cState.ChamberContents.Length <= 0;
|
||||
_menu.GrindButton.Disabled = !cState.CanGrind || !cState.Powered;
|
||||
@@ -74,6 +83,12 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
|
||||
{
|
||||
base.ReceiveMessage(message);
|
||||
|
||||
if (_menu == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case SharedReagentGrinderComponent.ReagentGrinderWorkStartedMessage workStarted:
|
||||
@@ -95,10 +110,16 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshContentsDisplay(IList<Solution.ReagentQuantity> reagents, IReadOnlyList<EntityUid> containedSolids, bool isBeakerAttached)
|
||||
private void RefreshContentsDisplay(IList<ReagentQuantity>? reagents, IReadOnlyList<EntityUid> containedSolids, bool isBeakerAttached)
|
||||
{
|
||||
//Refresh chamber contents
|
||||
_chamberVisualContents.Clear();
|
||||
|
||||
if (_menu == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_menu.ChamberContentBox.BoxContents.Clear();
|
||||
foreach (var uid in containedSolids)
|
||||
{
|
||||
@@ -131,8 +152,8 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
{
|
||||
for (var i = 0; i < reagents.Count; i++)
|
||||
{
|
||||
var goodIndex = _prototypeManager.TryIndex(reagents[i].ReagentId, out ReagentPrototype proto);
|
||||
var reagentName = goodIndex ? Loc.GetString($"{reagents[i].Quantity} {proto.Name}") : Loc.GetString("???");
|
||||
var goodIndex = _prototypeManager.TryIndex(reagents[i].ReagentId, out ReagentPrototype? proto);
|
||||
var reagentName = goodIndex ? Loc.GetString($"{reagents[i].Quantity} {proto!.Name}") : Loc.GetString("???");
|
||||
var reagentAdded = _menu.BeakerContentBox.BoxContents.AddItem(reagentName);
|
||||
var reagentIndex = _menu.BeakerContentBox.BoxContents.IndexOf(reagentAdded);
|
||||
_beakerVisualContents.Add(reagentIndex, reagents[i]);
|
||||
@@ -167,7 +188,8 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
|
||||
public sealed class LabelledContentBox : VBoxContainer
|
||||
{
|
||||
public string LabelText { get; set; }
|
||||
public string? LabelText { get; set; }
|
||||
|
||||
public ItemList BoxContents { get; set; }
|
||||
|
||||
public Button EjectButton { get; set; }
|
||||
@@ -176,7 +198,6 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
|
||||
public LabelledContentBox(string labelText, string buttonText)
|
||||
{
|
||||
|
||||
_label = new Label
|
||||
{
|
||||
Text = labelText,
|
||||
@@ -211,7 +232,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
}
|
||||
}
|
||||
|
||||
public GrinderMenu(ReagentGrinderBoundUserInterface owner = null)
|
||||
public GrinderMenu(ReagentGrinderBoundUserInterface owner)
|
||||
{
|
||||
SetSize = MinSize = (512, 256);
|
||||
Owner = owner;
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace Content.Client.GameObjects.Components
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public abstract class LightBehaviourAnimationTrack : AnimationTrackProperty
|
||||
{
|
||||
[Dependency] protected readonly IRobustRandom RobustRandom = default!;
|
||||
|
||||
[DataField("id")] [ViewVariables] public string ID { get; set; } = string.Empty;
|
||||
|
||||
[DataField("property")]
|
||||
@@ -55,19 +57,17 @@ namespace Content.Client.GameObjects.Components
|
||||
public AnimationInterpolationMode InterpolateMode { get; set; } = AnimationInterpolationMode.Linear;
|
||||
|
||||
[ViewVariables] protected float MaxTime { get; set; }
|
||||
protected PointLightComponent Light;
|
||||
protected IRobustRandom RobustRandom;
|
||||
|
||||
private float _maxTime = default;
|
||||
private IEntity _parent = default!;
|
||||
|
||||
public void Initialize(PointLightComponent light)
|
||||
public void Initialize(IEntity parent)
|
||||
{
|
||||
Light = light;
|
||||
RobustRandom = IoCManager.Resolve<IRobustRandom>();
|
||||
_parent = parent;
|
||||
|
||||
if (Enabled)
|
||||
if (Enabled && _parent.TryGetComponent(out PointLightComponent? light))
|
||||
{
|
||||
Light.Enabled = true;
|
||||
light.Enabled = true;
|
||||
}
|
||||
|
||||
OnInitialize();
|
||||
@@ -75,7 +75,10 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
public void UpdatePlaybackValues(Animation owner)
|
||||
{
|
||||
Light.Enabled = true;
|
||||
if (_parent.TryGetComponent(out PointLightComponent? light))
|
||||
{
|
||||
light.Enabled = true;
|
||||
}
|
||||
|
||||
if (MinDuration > 0)
|
||||
{
|
||||
@@ -103,13 +106,9 @@ namespace Content.Client.GameObjects.Components
|
||||
throw new InvalidOperationException("Property parameter is null! Check the prototype!");
|
||||
}
|
||||
|
||||
if (Light is IAnimationProperties properties)
|
||||
if (_parent.TryGetComponent(out PointLightComponent? light))
|
||||
{
|
||||
properties.SetAnimatableProperty(Property, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
AnimationHelper.SetAnimatableProperty(Light, Property, value);
|
||||
AnimationHelper.SetAnimatableProperty(light, Property, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,10 +218,10 @@ namespace Content.Client.GameObjects.Components
|
||||
[UsedImplicitly]
|
||||
public class RandomizeBehaviour : LightBehaviourAnimationTrack
|
||||
{
|
||||
private object _randomValue1;
|
||||
private object _randomValue2;
|
||||
private object _randomValue3;
|
||||
private object _randomValue4;
|
||||
private object? _randomValue1;
|
||||
private object _randomValue2 = default!;
|
||||
private object _randomValue3 = default!;
|
||||
private object _randomValue4 = default!;
|
||||
|
||||
public override void OnInitialize()
|
||||
{
|
||||
@@ -235,7 +234,7 @@ namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
if (Property == "Enabled") // special case for boolean, we randomize it
|
||||
{
|
||||
ApplyProperty(RobustRandom.NextDouble() < 0.5 ? true : false);
|
||||
ApplyProperty(RobustRandom.NextDouble() < 0.5);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -266,7 +265,7 @@ namespace Content.Client.GameObjects.Components
|
||||
ApplyProperty(InterpolateLinear(_randomValue3, _randomValue4, interpolateValue));
|
||||
break;
|
||||
case AnimationInterpolationMode.Cubic:
|
||||
ApplyProperty(InterpolateCubic(_randomValue1, _randomValue2, _randomValue3, _randomValue4, interpolateValue));
|
||||
ApplyProperty(InterpolateCubic(_randomValue1!, _randomValue2, _randomValue3, _randomValue4, interpolateValue));
|
||||
break;
|
||||
default:
|
||||
case AnimationInterpolationMode.Nearest:
|
||||
@@ -377,8 +376,6 @@ namespace Content.Client.GameObjects.Components
|
||||
private Angle _originalRotation;
|
||||
private Color _originalColor;
|
||||
private bool _originalEnabled;
|
||||
private PointLightComponent _lightComponent;
|
||||
private AnimationPlayerComponent _animationPlayer;
|
||||
|
||||
void ISerializationHooks.AfterDeserialization()
|
||||
{
|
||||
@@ -388,7 +385,7 @@ namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
var animation = new Animation()
|
||||
{
|
||||
AnimationTracks = { behaviour }
|
||||
AnimationTracks = {behaviour}
|
||||
};
|
||||
|
||||
_animations.Add(new AnimationContainer(key, animation, behaviour));
|
||||
@@ -401,12 +398,16 @@ namespace Content.Client.GameObjects.Components
|
||||
base.Startup();
|
||||
|
||||
CopyLightSettings();
|
||||
_animationPlayer = Owner.EnsureComponent<AnimationPlayerComponent>();
|
||||
_animationPlayer.AnimationCompleted += OnAnimationCompleted;
|
||||
Owner.EnsureComponentWarn<AnimationPlayerComponent>();
|
||||
|
||||
if (Owner.TryGetComponent(out AnimationPlayerComponent? animation))
|
||||
{
|
||||
animation.AnimationCompleted += OnAnimationCompleted;
|
||||
}
|
||||
|
||||
foreach (var container in _animations)
|
||||
{
|
||||
container.LightBehaviour.Initialize(_lightComponent);
|
||||
container.LightBehaviour.Initialize(Owner);
|
||||
}
|
||||
|
||||
// we need to initialize all behaviours before starting any
|
||||
@@ -423,10 +424,19 @@ namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
var container = _animations.FirstOrDefault(x => x.FullKey == key);
|
||||
|
||||
if (container == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (container.LightBehaviour.IsLooped)
|
||||
{
|
||||
container.LightBehaviour.UpdatePlaybackValues(container.Animation);
|
||||
_animationPlayer.Play(container.Animation, container.FullKey);
|
||||
|
||||
if (Owner.TryGetComponent(out AnimationPlayerComponent? animation))
|
||||
{
|
||||
animation.Play(container.Animation, container.FullKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,13 +445,13 @@ namespace Content.Client.GameObjects.Components
|
||||
/// </summary>
|
||||
private void CopyLightSettings()
|
||||
{
|
||||
if (Owner.TryGetComponent(out _lightComponent))
|
||||
if (Owner.TryGetComponent(out PointLightComponent? light))
|
||||
{
|
||||
_originalColor = _lightComponent.Color;
|
||||
_originalEnabled = _lightComponent.Enabled;
|
||||
_originalEnergy = _lightComponent.Energy;
|
||||
_originalRadius = _lightComponent.Radius;
|
||||
_originalRotation = _lightComponent.Rotation;
|
||||
_originalColor = light.Color;
|
||||
_originalEnabled = light.Enabled;
|
||||
_originalEnergy = light.Energy;
|
||||
_originalRadius = light.Radius;
|
||||
_originalRotation = light.Rotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -456,14 +466,19 @@ namespace Content.Client.GameObjects.Components
|
||||
/// </summary>
|
||||
public void StartLightBehaviour(string id = "")
|
||||
{
|
||||
if (!Owner.TryGetComponent(out AnimationPlayerComponent? animation))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var container in _animations)
|
||||
{
|
||||
if (container.LightBehaviour.ID == id || id == string.Empty)
|
||||
{
|
||||
if (!_animationPlayer.HasRunningAnimation(KeyPrefix + container.Key))
|
||||
if (!animation.HasRunningAnimation(KeyPrefix + container.Key))
|
||||
{
|
||||
container.LightBehaviour.UpdatePlaybackValues(container.Animation);
|
||||
_animationPlayer.Play(container.Animation, KeyPrefix + container.Key);
|
||||
animation.Play(container.Animation, KeyPrefix + container.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -479,15 +494,20 @@ namespace Content.Client.GameObjects.Components
|
||||
/// <param name="resetToOriginalSettings">Should the light have its original settings applied?</param>
|
||||
public void StopLightBehaviour(string id = "", bool removeBehaviour = false, bool resetToOriginalSettings = false)
|
||||
{
|
||||
if (!Owner.TryGetComponent(out AnimationPlayerComponent? animation))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var toRemove = new List<AnimationContainer>();
|
||||
|
||||
foreach (var container in _animations)
|
||||
{
|
||||
if (container.LightBehaviour.ID == id || id == string.Empty)
|
||||
{
|
||||
if (_animationPlayer.HasRunningAnimation(KeyPrefix + container.Key))
|
||||
if (animation.HasRunningAnimation(KeyPrefix + container.Key))
|
||||
{
|
||||
_animationPlayer.Stop(KeyPrefix + container.Key);
|
||||
animation.Stop(KeyPrefix + container.Key);
|
||||
}
|
||||
|
||||
if (removeBehaviour)
|
||||
@@ -502,13 +522,13 @@ namespace Content.Client.GameObjects.Components
|
||||
_animations.Remove(container);
|
||||
}
|
||||
|
||||
if (resetToOriginalSettings)
|
||||
if (resetToOriginalSettings && Owner.TryGetComponent(out PointLightComponent? light))
|
||||
{
|
||||
_lightComponent.Color = _originalColor;
|
||||
_lightComponent.Enabled = _originalEnabled;
|
||||
_lightComponent.Energy = _originalEnergy;
|
||||
_lightComponent.Radius = _originalRadius;
|
||||
_lightComponent.Rotation = _originalRotation;
|
||||
light.Color = _originalColor;
|
||||
light.Enabled = _originalEnabled;
|
||||
light.Energy = _originalEnergy;
|
||||
light.Radius = _originalRadius;
|
||||
light.Rotation = _originalRotation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -517,7 +537,7 @@ namespace Content.Client.GameObjects.Components
|
||||
/// </summary>
|
||||
public void AddNewLightBehaviour(LightBehaviourAnimationTrack behaviour, bool playImmediately = true)
|
||||
{
|
||||
int key = 0;
|
||||
var key = 0;
|
||||
|
||||
while (_animations.Any(x => x.Key == key))
|
||||
{
|
||||
@@ -526,10 +546,11 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
var animation = new Animation()
|
||||
{
|
||||
AnimationTracks = { behaviour }
|
||||
AnimationTracks = {behaviour}
|
||||
};
|
||||
|
||||
behaviour.Initialize(_lightComponent);
|
||||
behaviour.Initialize(Owner);
|
||||
|
||||
var container = new AnimationContainer(key, animation, behaviour);
|
||||
_animations.Add(container);
|
||||
|
||||
|
||||
@@ -28,9 +28,10 @@ namespace Content.Client.GameObjects.Components
|
||||
public CornerFill LastCornerSW { get; private set; }
|
||||
public CornerFill LastCornerNW { get; private set; }
|
||||
|
||||
[ViewVariables] private IEntity? _overlayEntity;
|
||||
|
||||
[ViewVariables]
|
||||
private IEntity _overlayEntity;
|
||||
private ISpriteComponent _overlaySprite;
|
||||
private ISpriteComponent? _overlaySprite;
|
||||
|
||||
protected override void Startup()
|
||||
{
|
||||
@@ -57,13 +58,18 @@ namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_overlayEntity.Delete();
|
||||
_overlayEntity?.Delete();
|
||||
}
|
||||
|
||||
internal override void CalculateNewSprite()
|
||||
{
|
||||
base.CalculateNewSprite();
|
||||
|
||||
if (Sprite == null || SnapGrid == null || _overlaySprite == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var (n, nl) = MatchingWall(SnapGrid.GetInDir(Direction.North));
|
||||
var (ne, nel) = MatchingWall(SnapGrid.GetInDir(Direction.NorthEast));
|
||||
var (e, el) = MatchingWall(SnapGrid.GetInDir(Direction.East));
|
||||
@@ -190,7 +196,7 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
foreach (var entity in SnapGrid.GetLocal())
|
||||
{
|
||||
if (entity.TryGetComponent(out WindowComponent window))
|
||||
if (entity.TryGetComponent(out WindowComponent? window))
|
||||
{
|
||||
window.UpdateSprite();
|
||||
}
|
||||
@@ -202,7 +208,7 @@ namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
foreach (var entity in candidates)
|
||||
{
|
||||
if (!entity.TryGetComponent(out IconSmoothComponent other))
|
||||
if (!entity.TryGetComponent(out IconSmoothComponent? other))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Content.Client.GameObjects.Components
|
||||
[UsedImplicitly]
|
||||
public class MagicMirrorBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
private MagicMirrorWindow _window;
|
||||
private MagicMirrorWindow? _window;
|
||||
|
||||
public MagicMirrorBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ namespace Content.Client.GameObjects.Components
|
||||
switch (message)
|
||||
{
|
||||
case MagicMirrorInitialDataMessage initialData:
|
||||
_window.SetInitialData(initialData);
|
||||
_window?.SetInitialData(initialData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
_window.Dispose();
|
||||
_window?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ namespace Content.Client.GameObjects.Components
|
||||
private byte _colorValue;
|
||||
private bool _ignoreEvents;
|
||||
|
||||
public event Action OnValueChanged;
|
||||
public event Action? OnValueChanged;
|
||||
|
||||
public byte ColorValue
|
||||
{
|
||||
@@ -170,8 +170,8 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
public class HairStylePicker : Control
|
||||
{
|
||||
public event Action<Color> OnHairColorPicked;
|
||||
public event Action<string> OnHairStylePicked;
|
||||
public event Action<Color>? OnHairColorPicked;
|
||||
public event Action<string>? OnHairStylePicked;
|
||||
|
||||
protected readonly ItemList Items;
|
||||
|
||||
@@ -257,7 +257,12 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
private void ItemSelected(ItemList.ItemListSelectedEventArgs args)
|
||||
{
|
||||
OnHairStylePicked?.Invoke(Items[args.ItemIndex].Text);
|
||||
var hairColor = Items[args.ItemIndex].Text;
|
||||
|
||||
if (hairColor != null)
|
||||
{
|
||||
OnHairStylePicked?.Invoke(hairColor);
|
||||
}
|
||||
}
|
||||
|
||||
// ColorSlider
|
||||
@@ -265,7 +270,7 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
public class EyeColorPicker : Control
|
||||
{
|
||||
public event Action<Color> OnEyeColorPicked;
|
||||
public event Action<Color>? OnEyeColorPicked;
|
||||
|
||||
private readonly ColorSlider _colorSliderR;
|
||||
private readonly ColorSlider _colorSliderG;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Client.GameObjects.Components.Markers
|
||||
{
|
||||
var system = EntitySystem.Get<MarkerSystem>();
|
||||
|
||||
if (Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
sprite.Visible = system.MarkersVisible;
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ namespace Content.Client.GameObjects.Components.MedicalScanner
|
||||
[UsedImplicitly]
|
||||
public class MedicalScannerBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
private MedicalScannerWindow? _window;
|
||||
|
||||
public MedicalScannerBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
private MedicalScannerWindow _window;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
@@ -29,7 +29,8 @@ namespace Content.Client.GameObjects.Components.MedicalScanner
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
_window.Populate((MedicalScannerBoundUserInterfaceState) state);
|
||||
|
||||
_window?.Populate((MedicalScannerBoundUserInterfaceState) state);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
@@ -37,7 +38,8 @@ namespace Content.Client.GameObjects.Components.MedicalScanner
|
||||
base.Dispose(disposing);
|
||||
if (!disposing)
|
||||
return;
|
||||
_window.Dispose();
|
||||
|
||||
_window?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Content.Client.GameObjects.Components.Mobs.Actions
|
||||
return _actionType == other._actionType && _itemActionType == other._itemActionType && Equals(_item, other._item);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is ActionAssignment other && Equals(other);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.GameObjects.Components.HUD.Inventory;
|
||||
using Content.Client.GameObjects.Components.Items;
|
||||
using Content.Client.GameObjects.Components.Mobs.Actions;
|
||||
|
||||
@@ -7,13 +7,13 @@ using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Mobs
|
||||
{
|
||||
@@ -24,8 +24,8 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
{
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
|
||||
private AlertsUI _ui;
|
||||
private AlertOrderPrototype _alertOrder;
|
||||
private AlertsUI? _ui;
|
||||
private AlertOrderPrototype? _alertOrder;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly Dictionary<AlertKey, AlertControl> _alertControls
|
||||
@@ -43,7 +43,7 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
PlayerDetached();
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent component)
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
switch (message)
|
||||
@@ -57,7 +57,7 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
|
||||
@@ -207,12 +207,17 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
return alertControl;
|
||||
}
|
||||
|
||||
private void AlertControlOnPressed(BaseButton.ButtonEventArgs args)
|
||||
private void AlertControlOnPressed(ButtonEventArgs args)
|
||||
{
|
||||
AlertPressed(args, args.Button as AlertControl);
|
||||
if (args.Button is not AlertControl control)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AlertPressed(args, control);
|
||||
}
|
||||
|
||||
private void AlertPressed(BaseButton.ButtonEventArgs args, AlertControl alert)
|
||||
private void AlertPressed(ButtonEventArgs args, AlertControl alert)
|
||||
{
|
||||
if (args.Event.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent component)
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
|
||||
private void UpdateHud()
|
||||
{
|
||||
if (Owner != _playerManager.LocalPlayer.ControlledEntity)
|
||||
if (Owner != _playerManager.LocalPlayer?.ControlledEntity)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Client.GameObjects.Components.ActionBlocking;
|
||||
using Content.Client.GameObjects.Components.ActionBlocking;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
@@ -42,16 +42,16 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
private void UpdateLooks()
|
||||
{
|
||||
if (Appearance is null ||
|
||||
!Owner.TryGetComponent(out SpriteComponent sprite))
|
||||
!Owner.TryGetComponent(out SpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Owner.TryGetComponent(out IBody body))
|
||||
if (Owner.TryGetComponent(out IBody? body))
|
||||
{
|
||||
foreach (var part in body.Parts.Values)
|
||||
{
|
||||
if (!part.Owner.TryGetComponent(out SpriteComponent partSprite))
|
||||
if (!part.Owner.TryGetComponent(out SpriteComponent? partSprite))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -94,12 +94,12 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
|
||||
public void BodyPartAdded(BodyPartAddedEventArgs args)
|
||||
{
|
||||
if (!Owner.TryGetComponent(out SpriteComponent sprite))
|
||||
if (!Owner.TryGetComponent(out SpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!args.Part.Owner.TryGetComponent(out SpriteComponent partSprite))
|
||||
if (!args.Part.Owner.TryGetComponent(out SpriteComponent? partSprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -117,12 +117,12 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
|
||||
public void BodyPartRemoved(BodyPartRemovedEventArgs args)
|
||||
{
|
||||
if (!Owner.TryGetComponent(out SpriteComponent sprite))
|
||||
if (!Owner.TryGetComponent(out SpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!args.Part.Owner.TryGetComponent(out SpriteComponent partSprite))
|
||||
if (!args.Part.Owner.TryGetComponent(out SpriteComponent? partSprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
offset *= (ResetTime - _time) / ResetTime;
|
||||
}
|
||||
|
||||
if (Owner.TryGetComponent(out ISpriteComponent spriteComponent))
|
||||
if (Owner.TryGetComponent(out ISpriteComponent? spriteComponent))
|
||||
{
|
||||
spriteComponent.Offset = offset;
|
||||
}
|
||||
|
||||
@@ -12,14 +12,14 @@ namespace Content.Client.GameObjects.Components.Mobs.State
|
||||
{
|
||||
base.EnterState(entity);
|
||||
|
||||
if (entity.TryGetComponent(out AppearanceComponent appearance))
|
||||
if (entity.TryGetComponent(out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(DamageStateVisuals.State, DamageState.Dead);
|
||||
}
|
||||
|
||||
EntitySystem.Get<StandingStateSystem>().Down(entity);
|
||||
|
||||
if (entity.TryGetComponent(out PhysicsComponent physics))
|
||||
if (entity.TryGetComponent(out PhysicsComponent? physics))
|
||||
{
|
||||
physics.CanCollide = false;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ namespace Content.Client.GameObjects.Components.Mobs.State
|
||||
|
||||
EntitySystem.Get<StandingStateSystem>().Standing(entity);
|
||||
|
||||
if (entity.TryGetComponent(out PhysicsComponent physics))
|
||||
if (entity.TryGetComponent(out PhysicsComponent? physics))
|
||||
{
|
||||
physics.CanCollide = true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Mobs.State;
|
||||
using Content.Shared.GameObjects.Components.Mobs.State;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Mobs.State
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Content.Client.GameObjects.Components.Mobs.State
|
||||
{
|
||||
base.EnterState(entity);
|
||||
|
||||
if (entity.TryGetComponent(out AppearanceComponent appearance))
|
||||
if (entity.TryGetComponent(out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(DamageStateVisuals.State, DamageState.Alive);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Morgue;
|
||||
using Content.Shared.GameObjects.Components.Morgue;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user