Added nullable to most Content.Shared files (#3238)
* Add nullable to some Content.Shared files. * Use [NotNullWhen(true)] * Undo adding now redundant !'s * Forgot one * Add a ton more nullable * You can guess * Fix some issues * It actually compiles now * Auto stash before merge of "null2" and "origin/master" * I lied * enable annotations -> enable * Revert ActionBlockerSystem.cs to original * Fix ActionBlockerSystem.cs * More nullable * Undo some added exclamation marks * Fix issues * Update Content.Shared/Maps/ContentTileDefinition.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Resolve some issues * Remove unused method * Fix more issues * Fix more issues * Fix more issues * Fix more issues * Fix issue, rollback SharedGhostComponent.cs * Update submodule * Fix issue, invert some if-statements to reduce nesting * Revert RobustToolbox * FIx things broken by merge * Some fixes - Replaced with string.Empty - Remove some exclamation marks - Revert file * Some fixes * Trivial #nullable enable * Fix null ables Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Content.Client.GameObjects.Components.Buckle
|
||||
|
||||
public override bool Buckled => _buckled;
|
||||
|
||||
public override bool TryBuckle(IEntity user, IEntity to)
|
||||
public override bool TryBuckle(IEntity? user, IEntity to)
|
||||
{
|
||||
// TODO: Prediction
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Observer;
|
||||
using Content.Shared.GameObjects.Components.Observer.GhostRoles;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
|
||||
@@ -119,15 +119,23 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
|
||||
private bool OnUseMouseDown(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||
{
|
||||
var dragger = args.Session?.AttachedEntity;
|
||||
if (args.Session?.AttachedEntity == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var dragger = args.Session.AttachedEntity;
|
||||
// cancel any current dragging if there is one (shouldn't be because they would've had to have lifted
|
||||
// the mouse, canceling the drag, but just being cautious)
|
||||
_dragDropHelper.EndDrag();
|
||||
|
||||
// possibly initiating a drag
|
||||
// check if the clicked entity is draggable
|
||||
if (EntityManager.TryGetEntity(args.EntityUid, out var entity))
|
||||
if (!EntityManager.TryGetEntity(args.EntityUid, out var entity))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if the entity is reachable
|
||||
if (!_interactionSystem.InRangeUnobstructed(dragger, entity))
|
||||
{
|
||||
@@ -138,29 +146,33 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
foreach (var draggable in entity.GetAllComponents<IDraggable>())
|
||||
{
|
||||
var dragEventArgs = new StartDragDropEventArgs(dragger, entity);
|
||||
if (draggable.CanStartDrag(dragEventArgs))
|
||||
|
||||
if (!draggable.CanStartDrag(dragEventArgs))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_draggables.Add(draggable);
|
||||
canDrag = true;
|
||||
}
|
||||
|
||||
if (!canDrag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (canDrag)
|
||||
{
|
||||
// wait to initiate a drag
|
||||
_dragDropHelper.MouseDown(entity);
|
||||
_dragger = dragger;
|
||||
_mouseDownTime = 0;
|
||||
|
||||
// don't want anything else to process the click,
|
||||
// but we will save the event so we can "re-play" it if this drag does
|
||||
// not turn into an actual drag so the click can be handled normally
|
||||
_savedMouseDown = args;
|
||||
}
|
||||
|
||||
return canDrag;
|
||||
}
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool OnBeginDrag()
|
||||
@@ -384,7 +396,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
|
||||
var valid = (bool?) null;
|
||||
// check if it's able to be dropped on by current dragged entity
|
||||
var dropArgs = new DragDropEventArgs(_dragger, pvsEntity.Transform.Coordinates, _dragDropHelper.Dragged, pvsEntity);
|
||||
var dropArgs = new DragDropEventArgs(_dragger!, pvsEntity.Transform.Coordinates, _dragDropHelper.Dragged, pvsEntity);
|
||||
|
||||
foreach (var comp in pvsEntity.GetAllComponents<IDragDropOn>())
|
||||
{
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace Content.Server.GameObjects.Components.Buckle
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool TryBuckle(IEntity user, IEntity to)
|
||||
public override bool TryBuckle(IEntity? user, IEntity to)
|
||||
{
|
||||
if (!CanBuckle(user, to, out var strap))
|
||||
{
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
if (beaker == null)
|
||||
{
|
||||
return new ReagentDispenserBoundUserInterfaceState(Powered, false, ReagentUnit.New(0), ReagentUnit.New(0),
|
||||
"", Inventory, Owner.Name, null, _dispenseAmount);
|
||||
string.Empty, Inventory, Owner.Name, null, _dispenseAmount);
|
||||
}
|
||||
|
||||
var solution = beaker.GetComponent<SolutionContainerComponent>();
|
||||
|
||||
@@ -95,10 +95,10 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
private readonly List<string> _targetList = new();
|
||||
|
||||
[ViewVariables]
|
||||
private string _target = "";
|
||||
private string? _target;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private string _tag = "";
|
||||
private string _tag = string.Empty;
|
||||
|
||||
[ViewVariables]
|
||||
public bool Powered =>
|
||||
@@ -288,6 +288,11 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
_container.Remove(entity);
|
||||
}
|
||||
|
||||
if (_target == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var holder = CreateTaggedHolder(entities, _target);
|
||||
|
||||
entryComponent.TryInsert(holder);
|
||||
@@ -441,7 +446,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.Message is UiTargetUpdateMessage tagMessage && TagRegex.IsMatch(tagMessage.Target))
|
||||
if (obj.Message is UiTargetUpdateMessage tagMessage && TagRegex.IsMatch(tagMessage.Target ?? string.Empty))
|
||||
{
|
||||
_target = tagMessage.Target;
|
||||
}
|
||||
@@ -714,6 +719,11 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
|
||||
bool IInteractHand.InteractHand(InteractHandEventArgs eventArgs)
|
||||
{
|
||||
if (eventArgs.User == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!eventArgs.User.TryGetComponent(out IActorComponent? actor))
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -76,6 +76,11 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
|
||||
public override bool Drop(DragDropEventArgs args)
|
||||
{
|
||||
if (args.User == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!args.User.TryGetComponent(out IActorComponent? actor)) return false;
|
||||
|
||||
OpenUserInterface(actor.playerSession);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -26,11 +27,11 @@ namespace Content.Shared.Access
|
||||
Name = Loc.GetString(Name);
|
||||
}
|
||||
|
||||
public string ID { get; private set; }
|
||||
public string ID { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The player-visible name of the access level, in the ID card console and such.
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
@@ -14,12 +16,11 @@ namespace Content.Shared.Actions
|
||||
[Dependency]
|
||||
private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
private Dictionary<ActionType, ActionPrototype> _typeToAction;
|
||||
private Dictionary<ItemActionType, ItemActionPrototype> _typeToItemAction;
|
||||
private readonly Dictionary<ActionType, ActionPrototype> _typeToAction = new();
|
||||
private readonly Dictionary<ItemActionType, ItemActionPrototype> _typeToItemAction = new();
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
_typeToAction = new Dictionary<ActionType, ActionPrototype>();
|
||||
foreach (var action in _prototypeManager.EnumeratePrototypes<ActionPrototype>())
|
||||
{
|
||||
if (!_typeToAction.TryAdd(action.ActionType, action))
|
||||
@@ -30,7 +31,6 @@ namespace Content.Shared.Actions
|
||||
}
|
||||
}
|
||||
|
||||
_typeToItemAction = new Dictionary<ItemActionType, ItemActionPrototype>();
|
||||
foreach (var action in _prototypeManager.EnumeratePrototypes<ItemActionPrototype>())
|
||||
{
|
||||
if (!_typeToItemAction.TryAdd(action.ActionType, action))
|
||||
@@ -53,7 +53,7 @@ namespace Content.Shared.Actions
|
||||
/// Tries to get the action of the indicated type
|
||||
/// </summary>
|
||||
/// <returns>true if found</returns>
|
||||
public bool TryGet(ActionType actionType, out ActionPrototype action)
|
||||
public bool TryGet(ActionType actionType, [NotNullWhen(true)] out ActionPrototype? action)
|
||||
{
|
||||
return _typeToAction.TryGetValue(actionType, out action);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ namespace Content.Shared.Actions
|
||||
/// Tries to get the item action of the indicated type
|
||||
/// </summary>
|
||||
/// <returns>true if found</returns>
|
||||
public bool TryGet(ItemActionType actionType, out ItemActionPrototype action)
|
||||
public bool TryGet(ItemActionType actionType, [NotNullWhen(true)] out ItemActionPrototype? action)
|
||||
{
|
||||
return _typeToItemAction.TryGetValue(actionType, out action);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Interfaces;
|
||||
#nullable enable
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -24,28 +25,28 @@ namespace Content.Shared.Actions
|
||||
/// action. Null if this is not an Instant ActionBehaviorType.
|
||||
/// Will be null on client side if the behavior is not in Content.Client.
|
||||
/// </summary>
|
||||
public IInstantAction InstantAction { get; private set; }
|
||||
public IInstantAction InstantAction { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The IToggleAction that should be invoked when performing this
|
||||
/// action. Null if this is not a Toggle ActionBehaviorType.
|
||||
/// Will be null on client side if the behavior is not in Content.Client.
|
||||
/// </summary>
|
||||
public IToggleAction ToggleAction { get; private set; }
|
||||
public IToggleAction ToggleAction { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The ITargetEntityAction that should be invoked when performing this
|
||||
/// action. Null if this is not a TargetEntity ActionBehaviorType.
|
||||
/// Will be null on client side if the behavior is not in Content.Client.
|
||||
/// </summary>
|
||||
public ITargetEntityAction TargetEntityAction { get; private set; }
|
||||
public ITargetEntityAction TargetEntityAction { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The ITargetPointAction that should be invoked when performing this
|
||||
/// action. Null if this is not a TargetPoint ActionBehaviorType.
|
||||
/// Will be null on client side if the behavior is not in Content.Client.
|
||||
/// </summary>
|
||||
public ITargetPointAction TargetPointAction { get; private set; }
|
||||
public ITargetPointAction TargetPointAction { get; private set; } = default!;
|
||||
|
||||
public override void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
@@ -61,7 +62,7 @@ namespace Content.Shared.Actions
|
||||
// TODO: Split this class into server/client after RobustToolbox#1405
|
||||
if (IoCManager.Resolve<IModuleManager>().IsClientModule) return;
|
||||
|
||||
IActionBehavior behavior = null;
|
||||
IActionBehavior? behavior = null;
|
||||
serializer.DataField(ref behavior, "behavior", null);
|
||||
switch (behavior)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace Content.Shared.Actions
|
||||
#nullable enable
|
||||
namespace Content.Shared.Actions
|
||||
{
|
||||
/// <summary>
|
||||
/// Every possible action. Corresponds to actionType in action prototypes.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -15,41 +16,41 @@ namespace Content.Shared.Actions
|
||||
/// </summary>
|
||||
public abstract class BaseActionPrototype : IPrototype
|
||||
{
|
||||
public string ID { get; private set; }
|
||||
public string ID { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Icon representing this action in the UI.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public SpriteSpecifier Icon { get; private set; }
|
||||
public SpriteSpecifier Icon { get; private set; } = SpriteSpecifier.Invalid;
|
||||
|
||||
/// <summary>
|
||||
/// For toggle actions only, icon to show when toggled on. If omitted,
|
||||
/// the action will simply be highlighted when turned on.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public SpriteSpecifier IconOn { get; private set; }
|
||||
public SpriteSpecifier IconOn { get; private set; } = SpriteSpecifier.Invalid;
|
||||
|
||||
/// <summary>
|
||||
/// Name to show in UI. Accepts formatting.
|
||||
/// </summary>
|
||||
public FormattedMessage Name { get; private set; }
|
||||
public FormattedMessage Name { get; private set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Description to show in UI. Accepts formatting.
|
||||
/// </summary>
|
||||
public FormattedMessage Description { get; private set; }
|
||||
public FormattedMessage Description { get; private set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Requirements message to show in UI. Accepts formatting, but generally should be avoided
|
||||
/// so the requirements message isn't too prominent in the tooltip.
|
||||
/// </summary>
|
||||
public string Requires { get; private set; }
|
||||
public string Requires { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The type of behavior this action has. This is valid clientside and serverside.
|
||||
/// </summary>
|
||||
public BehaviorType BehaviorType { get; protected set; }
|
||||
public BehaviorType BehaviorType { get; protected set; } = BehaviorType.None;
|
||||
|
||||
/// <summary>
|
||||
/// For targetpoint or targetentity actions, if this is true the action will remain
|
||||
@@ -73,12 +74,12 @@ namespace Content.Shared.Actions
|
||||
/// <summary>
|
||||
/// Filters that can be used to filter this item in action menu.
|
||||
/// </summary>
|
||||
public IEnumerable<string> Filters { get; private set; }
|
||||
public IEnumerable<string> Filters { get; private set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Keywords that can be used to search this item in action menu.
|
||||
/// </summary>
|
||||
public IEnumerable<string> Keywords { get; private set; }
|
||||
public IEnumerable<string> Keywords { get; private set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// True if this is an action that requires selecting a target
|
||||
@@ -99,7 +100,7 @@ namespace Content.Shared.Actions
|
||||
serializer.DataReadFunction("description", string.Empty,
|
||||
s => Description = FormattedMessage.FromMarkup(s));
|
||||
|
||||
serializer.DataField(this, x => x.Requires,"requires", null);
|
||||
serializer.DataField(this, x => x.Requires,"requires", string.Empty);
|
||||
serializer.DataField(this, x => x.Icon,"icon", SpriteSpecifier.Invalid);
|
||||
serializer.DataField(this, x => x.IconOn,"iconOn", SpriteSpecifier.Invalid);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -27,7 +28,7 @@ namespace Content.Shared.Actions
|
||||
/// <summary>
|
||||
/// Actions component of the performer.
|
||||
/// </summary>
|
||||
public readonly SharedActionsComponent PerformerActions;
|
||||
public readonly SharedActionsComponent? PerformerActions;
|
||||
|
||||
public ActionEventArgs(IEntity performer, ActionType actionType)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Actions
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Actions
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -34,7 +35,7 @@ namespace Content.Shared.Actions
|
||||
/// <summary>
|
||||
/// Item actions component of the item.
|
||||
/// </summary>
|
||||
public readonly ItemActionsComponent ItemActions;
|
||||
public readonly ItemActionsComponent? ItemActions;
|
||||
|
||||
public ItemActionEventArgs(IEntity performer, IEntity item, ItemActionType actionType)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Actions
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Actions
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Shared.Actions
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Shared.Actions
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Actions
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Actions
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Interfaces;
|
||||
#nullable enable
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -26,28 +27,28 @@ namespace Content.Shared.Actions
|
||||
/// action. Null if this is not an Instant ActionBehaviorType.
|
||||
/// Will be null on client side if the behavior is not in Content.Client.
|
||||
/// </summary>
|
||||
public IInstantItemAction InstantAction { get; private set; }
|
||||
public IInstantItemAction InstantAction { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The IToggleItemAction that should be invoked when performing this
|
||||
/// action. Null if this is not a Toggle ActionBehaviorType.
|
||||
/// Will be null on client side if the behavior is not in Content.Client.
|
||||
/// </summary>
|
||||
public IToggleItemAction ToggleAction { get; private set; }
|
||||
public IToggleItemAction ToggleAction { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The ITargetEntityItemAction that should be invoked when performing this
|
||||
/// action. Null if this is not a TargetEntity ActionBehaviorType.
|
||||
/// Will be null on client side if the behavior is not in Content.Client.
|
||||
/// </summary>
|
||||
public ITargetEntityItemAction TargetEntityAction { get; private set; }
|
||||
public ITargetEntityItemAction TargetEntityAction { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The ITargetPointItemAction that should be invoked when performing this
|
||||
/// action. Null if this is not a TargetPoint ActionBehaviorType.
|
||||
/// Will be null on client side if the behavior is not in Content.Client.
|
||||
/// </summary>
|
||||
public ITargetPointItemAction TargetPointAction { get; private set; }
|
||||
public ITargetPointItemAction TargetPointAction { get; private set; } = default!;
|
||||
|
||||
public override void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
@@ -65,7 +66,7 @@ namespace Content.Shared.Actions
|
||||
// TODO: Split this class into server/client after RobustToolbox#1405
|
||||
if (IoCManager.Resolve<IModuleManager>().IsClientModule) return;
|
||||
|
||||
IItemActionBehavior behavior = null;
|
||||
IItemActionBehavior? behavior = null;
|
||||
serializer.DataField(ref behavior, "behavior", null);
|
||||
switch (behavior)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Eui;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -25,7 +26,7 @@ namespace Content.Shared.Administration
|
||||
{
|
||||
public bool CloseAfter;
|
||||
public ReagentUnit Amount;
|
||||
public string ReagentId;
|
||||
public string ReagentId = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
|
||||
namespace Content.Shared.Administration
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Lidgren.Network;
|
||||
#nullable enable
|
||||
using Lidgren.Network;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
namespace Content.Shared.Administration.AdminMenu
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Eui;
|
||||
using Robust.Shared.Network;
|
||||
@@ -11,15 +12,15 @@ namespace Content.Shared.Administration
|
||||
{
|
||||
public bool IsLoading;
|
||||
|
||||
public AdminData[] Admins;
|
||||
public Dictionary<int, AdminRankData> AdminRanks;
|
||||
public AdminData[] Admins = Array.Empty<AdminData>();
|
||||
public Dictionary<int, AdminRankData> AdminRanks = new();
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public struct AdminData
|
||||
{
|
||||
public NetUserId UserId;
|
||||
public string UserName;
|
||||
public string Title;
|
||||
public string? UserName;
|
||||
public string? Title;
|
||||
public AdminFlags PosFlags;
|
||||
public AdminFlags NegFlags;
|
||||
public int? RankId;
|
||||
@@ -43,8 +44,8 @@ namespace Content.Shared.Administration
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class AddAdmin : EuiMessageBase
|
||||
{
|
||||
public string UserNameOrId;
|
||||
public string Title;
|
||||
public string UserNameOrId = string.Empty;
|
||||
public string? Title;
|
||||
public AdminFlags PosFlags;
|
||||
public AdminFlags NegFlags;
|
||||
public int? RankId;
|
||||
@@ -60,7 +61,7 @@ namespace Content.Shared.Administration
|
||||
public sealed class UpdateAdmin : EuiMessageBase
|
||||
{
|
||||
public NetUserId UserId;
|
||||
public string Title;
|
||||
public string? Title;
|
||||
public AdminFlags PosFlags;
|
||||
public AdminFlags NegFlags;
|
||||
public int? RankId;
|
||||
@@ -70,7 +71,7 @@ namespace Content.Shared.Administration
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class AddAdminRank : EuiMessageBase
|
||||
{
|
||||
public string Name;
|
||||
public string Name = string.Empty;
|
||||
public AdminFlags Flags;
|
||||
}
|
||||
|
||||
@@ -85,7 +86,7 @@ namespace Content.Shared.Administration
|
||||
{
|
||||
public int Id;
|
||||
|
||||
public string Name;
|
||||
public string Name = string.Empty;
|
||||
public AdminFlags Flags;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Eui;
|
||||
using Robust.Shared.Serialization;
|
||||
using System;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -13,12 +15,10 @@ namespace Content.Shared.Alert
|
||||
[Dependency]
|
||||
private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
private Dictionary<AlertType, AlertPrototype> _typeToAlert;
|
||||
private readonly Dictionary<AlertType, AlertPrototype> _typeToAlert = new();
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
_typeToAlert = new Dictionary<AlertType, AlertPrototype>();
|
||||
|
||||
foreach (var alert in _prototypeManager.EnumeratePrototypes<AlertPrototype>())
|
||||
{
|
||||
if (!_typeToAlert.TryAdd(alert.AlertType, alert))
|
||||
@@ -34,7 +34,7 @@ namespace Content.Shared.Alert
|
||||
/// Tries to get the alert of the indicated type
|
||||
/// </summary>
|
||||
/// <returns>true if found</returns>
|
||||
public bool TryGet(AlertType alertType, out AlertPrototype alert)
|
||||
public bool TryGet(AlertType alertType, [NotNullWhen(true)] out AlertPrototype? alert)
|
||||
{
|
||||
return _typeToAlert.TryGetValue(alertType, out alert);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -12,7 +13,7 @@ namespace Content.Shared.Alert
|
||||
[Prototype("alertOrder")]
|
||||
public class AlertOrderPrototype : IPrototype, IComparer<AlertPrototype>
|
||||
{
|
||||
public string ID { get; private set; }
|
||||
public string ID { get; private set; } = string.Empty;
|
||||
|
||||
private readonly Dictionary<AlertType, int> _typeToIdx = new();
|
||||
private readonly Dictionary<AlertCategory, int> _categoryToIdx = new();
|
||||
@@ -23,7 +24,7 @@ namespace Content.Shared.Alert
|
||||
|
||||
serializer.DataField(this, x => x.ID, "id", string.Empty);
|
||||
|
||||
if (!mapping.TryGetNode("order", out YamlSequenceNode orderMapping)) return;
|
||||
if (!mapping.TryGetNode("order", out YamlSequenceNode? orderMapping)) return;
|
||||
|
||||
var i = 0;
|
||||
foreach (var entryYaml in orderMapping)
|
||||
@@ -56,7 +57,7 @@ namespace Content.Shared.Alert
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int Compare(AlertPrototype x, AlertPrototype y)
|
||||
public int Compare(AlertPrototype? x, AlertPrototype? y)
|
||||
{
|
||||
if ((x == null) && (y == null)) return 0;
|
||||
if (x == null) return 1;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -17,7 +18,7 @@ namespace Content.Shared.Alert
|
||||
[Prototype("alert")]
|
||||
public class AlertPrototype : IPrototype
|
||||
{
|
||||
public string ID { get; private set; }
|
||||
public string ID { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Type of alert, no 2 alert prototypes should have the same one.
|
||||
@@ -31,17 +32,17 @@ namespace Content.Shared.Alert
|
||||
/// to get the correct icon path for a particular severity level.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public SpriteSpecifier Icon { get; private set; }
|
||||
public SpriteSpecifier Icon { get; private set; } = SpriteSpecifier.Invalid;
|
||||
|
||||
/// <summary>
|
||||
/// Name to show in tooltip window. Accepts formatting.
|
||||
/// </summary>
|
||||
public FormattedMessage Name { get; private set; }
|
||||
public FormattedMessage Name { get; private set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Description to show in tooltip window. Accepts formatting.
|
||||
/// </summary>
|
||||
public FormattedMessage Description { get; private set; }
|
||||
public FormattedMessage Description { get; private set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Category the alert belongs to. Only one alert of a given category
|
||||
@@ -85,7 +86,7 @@ namespace Content.Shared.Alert
|
||||
/// Defines what to do when the alert is clicked.
|
||||
/// This will always be null on clientside.
|
||||
/// </summary>
|
||||
public IAlertClick OnClick { get; private set; }
|
||||
public IAlertClick? OnClick { get; private set; }
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
@@ -198,7 +199,7 @@ namespace Content.Shared.Alert
|
||||
return AlertType == other.AlertType && AlertCategory == other.AlertCategory;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is AlertKey other && Equals(other);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace Content.Shared.Alert
|
||||
#nullable enable
|
||||
namespace Content.Shared.Alert
|
||||
{
|
||||
/// <summary>
|
||||
/// Every category of alert. Corresponds to category field in alert prototypes defined in YML
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Arcade
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Arcade
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
using System;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
@@ -7,12 +9,12 @@ namespace Content.Shared.Atmos
|
||||
[Prototype("gas")]
|
||||
public class GasPrototype : IPrototype
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
|
||||
// TODO: Control gas amount necessary for overlay to appear
|
||||
// TODO: Add interfaces for gas behaviours e.g. breathing, burning
|
||||
|
||||
public string ID { get; private set; }
|
||||
public string ID { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Specific heat for gas.
|
||||
@@ -43,25 +45,25 @@ namespace Content.Shared.Atmos
|
||||
/// <summary>
|
||||
/// If this reagent is in gas form, this is the path to the overlay that will be used to make the gas visible.
|
||||
/// </summary>
|
||||
public string GasOverlayTexture { get; private set; }
|
||||
public string GasOverlayTexture { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// If this reagent is in gas form, this will be the path to the RSI sprite that will be used to make the gas visible.
|
||||
/// </summary>
|
||||
public string GasOverlayState { get; set; }
|
||||
public string GasOverlayState { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// State for the gas RSI overlay.
|
||||
/// </summary>
|
||||
public string GasOverlaySprite { get; set; }
|
||||
public string GasOverlaySprite { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Path to the tile overlay used when this gas appears visible.
|
||||
/// </summary>
|
||||
public string OverlayPath { get; private set; }
|
||||
public string OverlayPath { get; private set; } = string.Empty;
|
||||
|
||||
|
||||
public string Color { get; private set; }
|
||||
public string Color { get; private set; } = string.Empty;
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
@@ -8,21 +10,20 @@ namespace Content.Shared.Audio
|
||||
[Prototype("soundCollection")]
|
||||
public sealed class SoundCollectionPrototype : IPrototype
|
||||
{
|
||||
public string ID { get; private set; }
|
||||
public IReadOnlyList<string> PickFiles { get; private set; }
|
||||
public string ID { get; private set; } = string.Empty;
|
||||
public List<string> PickFiles { get; private set; } = new();
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
ID = mapping.GetNode("id").AsString();
|
||||
|
||||
var pickFiles = new List<string>();
|
||||
// In the unlikely case the method gets called twice
|
||||
PickFiles.Clear();
|
||||
|
||||
foreach (var file in mapping.GetNode<YamlSequenceNode>("files"))
|
||||
{
|
||||
pickFiles.Add(file.AsString());
|
||||
PickFiles.Add(file.AsString());
|
||||
}
|
||||
|
||||
PickFiles = pickFiles;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
#nullable enable
|
||||
using Robust.Shared;
|
||||
using Robust.Shared.Configuration;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
|
||||
namespace Content.Shared.Chat
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Lidgren.Network;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using Lidgren.Network;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -28,12 +29,12 @@ namespace Content.Shared.Chat
|
||||
/// <summary>
|
||||
/// The actual message contents.
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// What to "wrap" the message contents with. Example is stuff like 'Joe says: "{0}"'
|
||||
/// </summary>
|
||||
public string MessageWrap { get; set; }
|
||||
public string MessageWrap { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The sending entity.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Interfaces.Chemistry;
|
||||
#nullable enable
|
||||
using Content.Shared.Interfaces.Chemistry;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
@@ -204,7 +205,7 @@ namespace Content.Shared.Chemistry
|
||||
return reagent < min ? min : reagent > max ? max : reagent;
|
||||
}
|
||||
|
||||
public override readonly bool Equals(object obj)
|
||||
public override readonly bool Equals(object? obj)
|
||||
{
|
||||
return obj is ReagentUnit unit &&
|
||||
_value == unit._value;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -278,12 +279,13 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
Color mixColor = default;
|
||||
var runningTotalQuantity = ReagentUnit.New(0);
|
||||
var protoManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
|
||||
foreach (var reagent in Contents)
|
||||
{
|
||||
runningTotalQuantity += reagent.Quantity;
|
||||
|
||||
if (!IoCManager.Resolve<IPrototypeManager>().TryIndex(reagent.ReagentId, out ReagentPrototype proto))
|
||||
if (!protoManager.TryIndex(reagent.ReagentId, out ReagentPrototype? proto))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -322,7 +324,7 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
foreach (var (reagentId, quantity) in _contents.ToArray())
|
||||
{
|
||||
if (!proto.TryIndex(reagentId, out ReagentPrototype reagent))
|
||||
if (!proto.TryIndex(reagentId, out ReagentPrototype? reagent))
|
||||
continue;
|
||||
|
||||
var removedAmount = reagent.ReactionEntity(entity, method, quantity);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -6,8 +7,8 @@ namespace Content.Shared.Construction
|
||||
{
|
||||
public abstract class ArbitraryInsertConstructionGraphStep : EntityInsertConstructionGraphStep
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public SpriteSpecifier Icon { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public SpriteSpecifier Icon { get; private set; } = SpriteSpecifier.Invalid;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -7,7 +8,7 @@ namespace Content.Shared.Construction
|
||||
{
|
||||
public class ComponentConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
||||
{
|
||||
public string Component { get; private set; }
|
||||
public string Component { get; private set; } = string.Empty;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Maps;
|
||||
#nullable enable
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -12,11 +13,11 @@ namespace Content.Shared.Construction.ConstructionConditions
|
||||
public class TileType : IConstructionCondition
|
||||
{
|
||||
|
||||
public List<string> TargetTiles { get; private set; }
|
||||
public List<string> TargetTiles { get; private set; } = new();
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.TargetTiles, "targets", null);
|
||||
serializer.DataField(this, x => x.TargetTiles, "targets", new List<string>());
|
||||
}
|
||||
|
||||
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,11 +14,11 @@ namespace Content.Shared.Construction
|
||||
public class ConstructionGraphEdge : IExposeData
|
||||
{
|
||||
private List<ConstructionGraphStep> _steps = new();
|
||||
private List<IEdgeCondition> _conditions;
|
||||
private List<IGraphAction> _completed;
|
||||
private List<IEdgeCondition> _conditions = new();
|
||||
private List<IGraphAction> _completed = new();
|
||||
|
||||
[ViewVariables]
|
||||
public string Target { get; private set; }
|
||||
public string Target { get; private set; } = string.Empty;
|
||||
|
||||
[ViewVariables]
|
||||
public IReadOnlyList<IEdgeCondition> Conditions => _conditions;
|
||||
@@ -48,7 +49,7 @@ namespace Content.Shared.Construction
|
||||
var serializer = YamlObjectSerializer.NewReader(mapping);
|
||||
InternalExposeData(serializer);
|
||||
|
||||
if (!mapping.TryGetNode("steps", out YamlSequenceNode stepsMapping)) return;
|
||||
if (!mapping.TryGetNode("steps", out YamlSequenceNode? stepsMapping)) return;
|
||||
|
||||
foreach (var yamlNode in stepsMapping)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -10,7 +11,7 @@ namespace Content.Shared.Construction
|
||||
[Serializable]
|
||||
public abstract class ConstructionGraphStep : IExposeData
|
||||
{
|
||||
private List<IGraphAction> _completed;
|
||||
private List<IGraphAction> _completed = new();
|
||||
public float DoAfter { get; private set; }
|
||||
public IReadOnlyList<IGraphAction> Completed => _completed;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -9,50 +10,50 @@ namespace Content.Shared.Construction
|
||||
[Prototype("construction")]
|
||||
public class ConstructionPrototype : IPrototype
|
||||
{
|
||||
private List<IConstructionCondition> _conditions;
|
||||
private List<IConstructionCondition> _conditions = new();
|
||||
|
||||
/// <summary>
|
||||
/// Friendly name displayed in the construction GUI.
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// "Useful" description displayed in the construction GUI.
|
||||
/// </summary>
|
||||
public string Description { get; private set; }
|
||||
public string Description { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="ConstructionGraphPrototype"/> this construction will be using.
|
||||
/// </summary>
|
||||
public string Graph { get; private set; }
|
||||
public string Graph { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The target <see cref="ConstructionGraphNode"/> this construction will guide the user to.
|
||||
/// </summary>
|
||||
public string TargetNode { get; private set; }
|
||||
public string TargetNode { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The starting <see cref="ConstructionGraphNode"/> this construction will start at.
|
||||
/// </summary>
|
||||
public string StartNode { get; private set; }
|
||||
public string StartNode { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Texture path inside the construction GUI.
|
||||
/// </summary>
|
||||
public SpriteSpecifier Icon { get; private set; }
|
||||
public SpriteSpecifier Icon { get; private set; } = SpriteSpecifier.Invalid;
|
||||
|
||||
/// <summary>
|
||||
/// If you can start building or complete steps on impassable terrain.
|
||||
/// </summary>
|
||||
public bool CanBuildInImpassable { get; private set; }
|
||||
|
||||
public string Category { get; private set; }
|
||||
public string Category { get; private set; } = string.Empty;
|
||||
|
||||
public ConstructionType Type { get; private set; }
|
||||
public ConstructionType Type { get; private set; } = ConstructionType.Structure;
|
||||
|
||||
public string ID { get; private set; }
|
||||
public string ID { get; private set; } = string.Empty;
|
||||
|
||||
public string PlacementMode { get; private set; }
|
||||
public string PlacementMode { get; private set; } = "PlaceFree";
|
||||
|
||||
/// <summary>
|
||||
/// Whether this construction can be constructed rotated or not.
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Construction
|
||||
{
|
||||
public abstract class EntityInsertConstructionGraphStep : ConstructionGraphStep
|
||||
{
|
||||
public string Store { get; private set; }
|
||||
public string Store { get; private set; } = string.Empty;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
#nullable enable
|
||||
using System.Threading.Tasks;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
@@ -11,7 +12,7 @@ namespace Content.Shared.Construction
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
if (!mapping.TryGetNode("steps", out YamlSequenceNode steps)) return;
|
||||
if (!mapping.TryGetNode("steps", out YamlSequenceNode? steps)) return;
|
||||
|
||||
foreach (var node in steps)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -7,7 +8,7 @@ namespace Content.Shared.Construction
|
||||
{
|
||||
public class PrototypeConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
||||
{
|
||||
public string Prototype { get; private set; }
|
||||
public string Prototype { get; private set; } = string.Empty;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -9,7 +10,7 @@ namespace Content.Shared.Construction
|
||||
{
|
||||
public ToolQuality Tool { get; private set; }
|
||||
public float Fuel { get; private set; }
|
||||
public string ExamineOverride { get; private set; }
|
||||
public string ExamineOverride { get; private set; } = string.Empty;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
@@ -24,7 +25,7 @@ namespace Content.Shared.Damage
|
||||
return DamageSystem.ClassToType[@class];
|
||||
}
|
||||
|
||||
public static Dictionary<DamageClass, T> ToNewDictionary<T>()
|
||||
public static Dictionary<DamageClass, T> ToNewDictionary<T>() where T : struct
|
||||
{
|
||||
return Enum.GetValues(typeof(DamageClass))
|
||||
.Cast<DamageClass>()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -15,9 +16,9 @@ namespace Content.Shared.Damage.DamageContainer
|
||||
public class DamageContainerPrototype : IPrototype
|
||||
{
|
||||
private bool _supportAll;
|
||||
private HashSet<DamageClass> _supportedClasses;
|
||||
private HashSet<DamageType> _supportedTypes;
|
||||
private string _id;
|
||||
private HashSet<DamageClass> _supportedClasses = new();
|
||||
private HashSet<DamageType> _supportedTypes = new();
|
||||
private string _id = string.Empty;
|
||||
|
||||
// TODO NET 5 IReadOnlySet
|
||||
[ViewVariables] public IReadOnlyCollection<DamageClass> SupportedClasses => _supportedClasses;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
@@ -29,7 +30,7 @@ namespace Content.Shared.Damage
|
||||
return DamageSystem.TypeToClass[type];
|
||||
}
|
||||
|
||||
public static Dictionary<DamageType, T> ToNewDictionary<T>()
|
||||
public static Dictionary<DamageType, T> ToNewDictionary<T>() where T : struct
|
||||
{
|
||||
return Enum.GetValues(typeof(DamageType))
|
||||
.Cast<DamageType>()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -32,7 +33,7 @@ namespace Content.Shared.Damage.ResistanceSet
|
||||
_resistances = data.Resistances;
|
||||
}
|
||||
|
||||
public string ID { get; }
|
||||
public string ID { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Adjusts input damage with the resistance set values.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -14,15 +15,15 @@ namespace Content.Shared.Damage.ResistanceSet
|
||||
[Serializable, NetSerializable]
|
||||
public class ResistanceSetPrototype : IPrototype
|
||||
{
|
||||
private Dictionary<DamageType, float> _coefficients;
|
||||
private Dictionary<DamageType, int> _flatReductions;
|
||||
private string _id;
|
||||
private Dictionary<DamageType, float> _coefficients = new();
|
||||
private Dictionary<DamageType, int> _flatReductions = new();
|
||||
private string _id = string.Empty;
|
||||
|
||||
[ViewVariables] public Dictionary<DamageType, float> Coefficients => _coefficients;
|
||||
|
||||
[ViewVariables] public Dictionary<DamageType, int> FlatReductions => _flatReductions;
|
||||
|
||||
[ViewVariables] public Dictionary<DamageType, ResistanceSetSettings> Resistances { get; private set; }
|
||||
[ViewVariables] public Dictionary<DamageType, ResistanceSetSettings> Resistances { get; private set; } = new();
|
||||
|
||||
[ViewVariables] public string ID => _id;
|
||||
|
||||
@@ -31,8 +32,8 @@ namespace Content.Shared.Damage.ResistanceSet
|
||||
var serializer = YamlObjectSerializer.NewReader(mapping);
|
||||
|
||||
serializer.DataField(ref _id, "id", string.Empty);
|
||||
serializer.DataField(ref _coefficients, "coefficients", null);
|
||||
serializer.DataField(ref _flatReductions, "flatReductions", null);
|
||||
serializer.DataField(ref _coefficients, "coefficients", new Dictionary<DamageType, float>());
|
||||
serializer.DataField(ref _flatReductions, "flatReductions", new Dictionary<DamageType, int>());
|
||||
|
||||
Resistances = new Dictionary<DamageType, ResistanceSetSettings>();
|
||||
foreach (var damageType in (DamageType[]) Enum.GetValues(typeof(DamageType)))
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Chemistry;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
|
||||
namespace Content.Shared.Eui
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Eui
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -49,16 +50,16 @@ namespace Content.Shared.GameObjects.Components.Access
|
||||
public readonly bool IsPrivilegedIdAuthorized;
|
||||
public readonly bool IsTargetIdPresent;
|
||||
public readonly string TargetIdName;
|
||||
public readonly string TargetIdFullName;
|
||||
public readonly string TargetIdJobTitle;
|
||||
public readonly string[] TargetIdAccessList;
|
||||
public readonly string? TargetIdFullName;
|
||||
public readonly string? TargetIdJobTitle;
|
||||
public readonly string[]? TargetIdAccessList;
|
||||
|
||||
public IdCardConsoleBoundUserInterfaceState(bool isPrivilegedIdPresent,
|
||||
bool isPrivilegedIdAuthorized,
|
||||
bool isTargetIdPresent,
|
||||
string targetIdFullName,
|
||||
string targetIdJobTitle,
|
||||
string[] targetIdAccessList, string privilegedIdName, string targetIdName)
|
||||
string? targetIdFullName,
|
||||
string? targetIdJobTitle,
|
||||
string[]? targetIdAccessList, string privilegedIdName, string targetIdName)
|
||||
{
|
||||
IsPrivilegedIdPresent = isPrivilegedIdPresent;
|
||||
IsPrivilegedIdAuthorized = isPrivilegedIdAuthorized;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -12,9 +13,9 @@ namespace Content.Shared.GameObjects.Components.ActionBlocking
|
||||
[Serializable, NetSerializable]
|
||||
protected sealed class HandcuffedComponentState : ComponentState
|
||||
{
|
||||
public string IconState { get; }
|
||||
public string? IconState { get; }
|
||||
|
||||
public HandcuffedComponentState(string iconState) : base(ContentNetIDs.HANDCUFFS)
|
||||
public HandcuffedComponentState(string? iconState) : base(ContentNetIDs.HANDCUFFS)
|
||||
{
|
||||
IconState = iconState;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Objectives;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Atmos.GasTank
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Atmos.GasTank
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.Serialization;
|
||||
#nullable enable
|
||||
using Robust.Shared.Serialization;
|
||||
using System;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Atmos
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable annotations
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
using System;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Atmos
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Atmos
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry;
|
||||
#nullable enable
|
||||
using Content.Shared.Chemistry;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Body.Networks
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a component as being capable of containing parts.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Body.Part.Property
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Body.Part.Property
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Body.Part.Property
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Body.Part.Property
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user