mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Remove some unused obsolete stuff (#2049)
This commit is contained in:
@@ -632,8 +632,9 @@ namespace Robust.Client.Console.Commands
|
||||
}
|
||||
});
|
||||
|
||||
tabContainer.AddChild(new HSplitContainer
|
||||
tabContainer.AddChild(new SplitContainer
|
||||
{
|
||||
Orientation = SplitContainer.SplitOrientation.Horizontal,
|
||||
Children =
|
||||
{
|
||||
new PanelContainer
|
||||
|
||||
@@ -60,7 +60,6 @@ namespace Robust.Client.GameObjects
|
||||
public override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
UnsubscribeNetworkEvent<SendGridTileLookupMessage>();
|
||||
IoCManager.Resolve<IUserInterfaceManager>().StateRoot.RemoveChild(_label);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Prototypes;
|
||||
using System;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Robust.Client.GameStates
|
||||
@@ -35,10 +35,10 @@ namespace Robust.Client.GameStates
|
||||
foreach (var boundingBox in _componentManager.EntityQuery<IPhysBody>(true))
|
||||
{
|
||||
// all entities have a TransformComponent
|
||||
var transform = ((IComponent)boundingBox).Owner.Transform;
|
||||
var transform = boundingBox.Owner.Transform;
|
||||
|
||||
// if not on the same map, continue
|
||||
if (transform.MapID != _eyeManager.CurrentMap || !transform.IsMapTransform)
|
||||
if (transform.MapID != _eyeManager.CurrentMap || boundingBox.Owner.IsInContainer())
|
||||
continue;
|
||||
|
||||
// This entity isn't lerping, no need to draw debug info for it
|
||||
|
||||
@@ -111,12 +111,6 @@ namespace Robust.Client.Graphics
|
||||
|
||||
public Texture? Texture { get; set; }
|
||||
|
||||
[Obsolete("Use SetPatchMargin")]
|
||||
public void SetMargin(Margin margin, float value)
|
||||
{
|
||||
SetPatchMargin(margin, value);
|
||||
}
|
||||
|
||||
public void SetPatchMargin(Margin margin, float value)
|
||||
{
|
||||
if ((margin & Margin.Top) != 0)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Text;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -55,12 +54,6 @@ namespace Robust.Client.Graphics
|
||||
DrawingHandleScreen handle, Rune rune, Vector2 baseline, float scale,
|
||||
Color color, bool fallback=true);
|
||||
|
||||
[Obsolete("Use Rune variant instead")]
|
||||
public float DrawChar(DrawingHandleScreen handle, char chr, Vector2 baseline, float scale, Color color)
|
||||
{
|
||||
return DrawChar(handle, (Rune) chr, baseline, scale, color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets metrics describing the dimensions and positioning of a single glyph in the font.
|
||||
/// </summary>
|
||||
|
||||
@@ -391,34 +391,6 @@ namespace Robust.Client.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A proxy to <see cref="DesiredSize"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is in virtual pixels.
|
||||
/// </remarks>
|
||||
/// <seealso cref="CombinedPixelMinimumSize"/>
|
||||
[Obsolete("Use DesiredSize and Measure()")]
|
||||
public Vector2 CombinedMinimumSize => DesiredSize;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="CombinedMinimumSize"/>, in physical pixels.
|
||||
/// </summary>
|
||||
[Obsolete("Use DesiredSize and Measure()")]
|
||||
public Vector2i CombinedPixelMinimumSize => (Vector2i) (CombinedMinimumSize * UIScale);
|
||||
|
||||
/// <summary>
|
||||
/// A custom minimum size. If the control-calculated size is is smaller than this, this is used instead.
|
||||
/// </summary>
|
||||
/// <seealso cref="CombinedMinimumSize" />
|
||||
[ViewVariables]
|
||||
[Obsolete("Use MinSize instead.")]
|
||||
public Vector2 CustomMinimumSize
|
||||
{
|
||||
get => (_minWidth, _minHeight);
|
||||
set => (MinWidth, MinHeight) = Vector2.ComponentMax(Vector2.Zero, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A settable minimum size for this control.
|
||||
/// This is factored into <see cref="MeasureCore"/> so that this control itself always has at least this size.
|
||||
|
||||
@@ -84,6 +84,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
get => GetCount(Dimension.Row);
|
||||
set => SetCount(Dimension.Row, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The max width (in virtual pixels) the grid of elements can have. This dynamically determines
|
||||
/// the number of columns based on the size of the elements. Setting this puts this grid
|
||||
@@ -100,12 +101,6 @@ namespace Robust.Client.UserInterface.Controls
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown if the value assigned is less than or equal to 0.
|
||||
/// </exception>
|
||||
[Obsolete("Use MaxGridWidth")]
|
||||
public new float MaxWidth
|
||||
{
|
||||
set => MaxGridWidth = value;
|
||||
}
|
||||
|
||||
public float MaxGridWidth
|
||||
{
|
||||
set => SetMaxSize(Dimension.Column, value);
|
||||
@@ -127,12 +122,6 @@ namespace Robust.Client.UserInterface.Controls
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown if the value assigned is less than or equal to 0.
|
||||
/// </exception>
|
||||
[Obsolete("Use MaxGridHeight")]
|
||||
public new float MaxHeight
|
||||
{
|
||||
set => MaxGridHeight = value;
|
||||
}
|
||||
|
||||
public float MaxGridHeight
|
||||
{
|
||||
set => SetMaxSize(Dimension.Row, value);
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
[Obsolete("Use SplitContainer directly and set Orientation")]
|
||||
public class HSplitContainer : SplitContainer
|
||||
{
|
||||
public HSplitContainer()
|
||||
{
|
||||
Orientation = SplitOrientation.Horizontal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,12 +135,6 @@ namespace Robust.Client.UserInterface.Controls
|
||||
SetMarginBottom(control, diffY + control.GetValue<float>(MarginBottomProperty));
|
||||
}
|
||||
|
||||
[Obsolete("Change SetSize on the control instead.")]
|
||||
public new static void SetSize(Control control, Vector2 size)
|
||||
{
|
||||
control.SetSize = size;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets an anchor AND a margin preset. This is most likely the method you want.
|
||||
///
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
[Obsolete("Use SplitContainer directly and set Orientation")]
|
||||
public class VSplitContainer : SplitContainer
|
||||
{
|
||||
public VSplitContainer()
|
||||
{
|
||||
Orientation = SplitOrientation.Vertical;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Client.AutoGenerated;
|
||||
@@ -19,9 +18,6 @@ namespace Robust.Client.UserInterface.CustomControls
|
||||
public const string StyleClassWindowHeader = "windowHeader";
|
||||
public const string StyleClassWindowCloseButton = "windowCloseButton";
|
||||
|
||||
[Obsolete("Set SetSize instead.")]
|
||||
protected virtual Vector2? CustomSize => null;
|
||||
|
||||
public SS14Window()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
@@ -36,7 +32,6 @@ namespace Robust.Client.UserInterface.CustomControls
|
||||
}
|
||||
|
||||
public Control Contents { get; private set; }
|
||||
//private TextureButton CloseButton;
|
||||
|
||||
private const int DRAG_MARGIN_SIZE = 7;
|
||||
|
||||
@@ -52,20 +47,6 @@ namespace Robust.Client.UserInterface.CustomControls
|
||||
base.MeasureOverride(Vector2.ComponentMax(availableSize, ContentsMinimumSize)));
|
||||
}
|
||||
|
||||
protected override void Opened()
|
||||
{
|
||||
base.Opened();
|
||||
|
||||
#pragma warning disable 618
|
||||
if (_firstTimeOpened && CustomSize != null)
|
||||
{
|
||||
SetSize = CustomSize.Value;
|
||||
}
|
||||
#pragma warning restore 618
|
||||
}
|
||||
|
||||
//private Label TitleLabel;
|
||||
|
||||
public string? Title
|
||||
{
|
||||
get => TitleLabel.Text;
|
||||
|
||||
@@ -11,9 +11,6 @@ namespace Robust.Shared.Maths
|
||||
{
|
||||
public static Angle Zero { get; } = new();
|
||||
|
||||
[Obsolete("Use Angle.Zero")]
|
||||
public static Angle South { get; } = new(-MathHelper.PiOver2);
|
||||
|
||||
/// <summary>
|
||||
/// Angle in radians.
|
||||
/// </summary>
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Robust.Shared.GameObjects
|
||||
|
||||
/// <inheritdoc />
|
||||
public event Action<string>? ComponentIgnoreAdded;
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<Type> AllRegisteredTypes => types.Keys;
|
||||
|
||||
@@ -106,12 +106,6 @@ namespace Robust.Shared.GameObjects
|
||||
});
|
||||
}
|
||||
|
||||
[Obsolete("Use RegisterClass and Attributes instead of the Register/RegisterReference combo")]
|
||||
public void Register<T>(bool overwrite = false) where T : IComponent, new()
|
||||
{
|
||||
Register(typeof(T), overwrite);
|
||||
}
|
||||
|
||||
private void Register(Type type, bool overwrite = false)
|
||||
{
|
||||
if (_networkedComponents is not null)
|
||||
@@ -165,12 +159,6 @@ namespace Robust.Shared.GameObjects
|
||||
ComponentAdded?.Invoke(registration);
|
||||
}
|
||||
|
||||
[Obsolete("Use RegisterClass and Attributes instead of the Register/RegisterReference combo")]
|
||||
public void RegisterReference<TTarget, TInterface>() where TTarget : TInterface, IComponent, new()
|
||||
{
|
||||
RegisterReference(typeof(TTarget), typeof(TInterface));
|
||||
}
|
||||
|
||||
private void RegisterReference(Type target, Type @interface)
|
||||
{
|
||||
if (_networkedComponents is not null)
|
||||
@@ -217,7 +205,7 @@ namespace Robust.Shared.GameObjects
|
||||
throw new ComponentRegistrationLockException();
|
||||
|
||||
var registration = names[name];
|
||||
|
||||
|
||||
names.Remove(registration.Name);
|
||||
_lowerCaseNames.Remove(registration.Name.ToLowerInvariant());
|
||||
types.Remove(registration.Type);
|
||||
|
||||
@@ -89,11 +89,6 @@ namespace Robust.Shared.GameObjects
|
||||
/// </summary>
|
||||
public EntityUid ParentUid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not this entity is on the map, AKA it has no parent.
|
||||
/// </summary>
|
||||
bool IsMapTransform { get; }
|
||||
|
||||
Vector2? LerpDestination { get; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Robust.Shared.Animations;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
@@ -219,9 +218,6 @@ namespace Robust.Shared.GameObjects
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Use ContainerHelper to check if this entity is inside a container.")]
|
||||
public bool IsMapTransform => !Owner.IsInContainer();
|
||||
|
||||
/// <inheritdoc />
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[Animatable]
|
||||
|
||||
@@ -108,20 +108,6 @@ namespace Robust.Shared.GameObjects
|
||||
_subscriptions.Add(new SubBroadcast<EntitySessionMessage<T>>(src));
|
||||
}
|
||||
|
||||
[Obsolete("Unsubscribing of entity system events is now automatic")]
|
||||
protected void UnsubscribeNetworkEvent<T>()
|
||||
where T : notnull
|
||||
{
|
||||
EntityManager.EventBus.UnsubscribeEvent<T>(EventSource.Network, this);
|
||||
}
|
||||
|
||||
[Obsolete("Unsubscribing of entity system events is now automatic")]
|
||||
protected void UnsubscribeLocalEvent<T>()
|
||||
where T : notnull
|
||||
{
|
||||
EntityManager.EventBus.UnsubscribeEvent<T>(EventSource.Local, this);
|
||||
}
|
||||
|
||||
protected void SubscribeLocalEvent<TComp, TEvent>(
|
||||
ComponentEventHandler<TComp, TEvent> handler,
|
||||
Type[]? before = null, Type[]? after = null)
|
||||
@@ -146,22 +132,6 @@ namespace Robust.Shared.GameObjects
|
||||
_subscriptions.Add(new SubLocal<TComp, TEvent>());
|
||||
}
|
||||
|
||||
[Obsolete("Unsubscribing of entity system events is now automatic")]
|
||||
protected void UnsubscribeLocalEvent<TComp, TEvent>(ComponentEventHandler<TComp, TEvent> handler)
|
||||
where TComp : IComponent
|
||||
where TEvent : notnull
|
||||
{
|
||||
EntityManager.EventBus.UnsubscribeLocalEvent<TComp, TEvent>();
|
||||
}
|
||||
|
||||
[Obsolete("Unsubscribing of entity system events is now automatic")]
|
||||
protected void UnsubscribeLocalEvent<TComp, TEvent>()
|
||||
where TComp : IComponent
|
||||
where TEvent : notnull
|
||||
{
|
||||
EntityManager.EventBus.UnsubscribeLocalEvent<TComp, TEvent>();
|
||||
}
|
||||
|
||||
private void ShutdownSubscriptions()
|
||||
{
|
||||
if (_subscriptions == null)
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Robust.Shared.GameObjects
|
||||
/// Before a component can be spawned, it must be registered so things such as name, networking ID, type, etc...
|
||||
/// are known to the factory.
|
||||
/// Components are registered into a registry.
|
||||
/// The relevant methods for writing to this registry are <see cref="Register" /> and <see cref="RegisterReference" />.
|
||||
/// The relevant methods for writing to this registry are <see cref="RegisterReference" />.
|
||||
/// The data is exposed for reading through <see cref="GetRegistration" /> and its overloads.
|
||||
/// This data is returned in the form of a <see cref="IComponentRegistration" />, which represents one component's registration.
|
||||
/// </p>
|
||||
@@ -77,25 +77,10 @@ namespace Robust.Shared.GameObjects
|
||||
/// <returns>The availability of the component.</returns>
|
||||
ComponentAvailability GetComponentAvailability(string componentName, bool ignoreCase = false);
|
||||
|
||||
/// <summary>
|
||||
/// Registers a prototype to be available for spawning.
|
||||
/// </summary>
|
||||
/// <param name="overwrite">If the component already exists, will this replace it?</param>
|
||||
/// <remarks>
|
||||
/// This implicitly calls <see cref="RegisterReference{TTarget, TInterface}"/>
|
||||
/// with a <c>TTarget</c> and <c>TInterface</c> of <typeparamref name="T"/>.
|
||||
/// </remarks>
|
||||
|
||||
[Obsolete("Use RegisterClass and Attributes instead of the Register/RegisterReference combo")]
|
||||
void Register<T>(bool overwrite = false) where T : IComponent, new();
|
||||
|
||||
/// <summary>
|
||||
/// Registers a component class with the factory.
|
||||
/// </summary>
|
||||
/// <param name="overwrite">If the component already exists, will this replace it?</param>
|
||||
/// <remarks>
|
||||
/// Unlike <see cref="Register{T}"/>, this reads the attributes. No more Register/RegisterReference combos.
|
||||
/// </remarks>
|
||||
void RegisterClass<T>(bool overwrite = false) where T : IComponent, new();
|
||||
|
||||
/// <summary>
|
||||
@@ -105,15 +90,6 @@ namespace Robust.Shared.GameObjects
|
||||
/// <param name="overwrite">Whether to overrde existing settings instead of throwing an exception in the case of duplicates.</param>
|
||||
void RegisterIgnore(string name, bool overwrite = false);
|
||||
|
||||
// NOTE: no overwrite here, it'd overcomplicate RegisterReference a LOT.
|
||||
// If you need to overwrite references for some sick reason overwrite the component too.
|
||||
/// <summary>
|
||||
/// Registers <typeparamref name="TTarget" /> to be referenced when
|
||||
/// <typeparamref name="TInterface"/> is used in methods like <see cref="IEntity.GetComponent{T}"/>
|
||||
/// </summary>
|
||||
[Obsolete("Use RegisterClass and Attributes instead of the Register/RegisterReference combo")]
|
||||
void RegisterReference<TTarget, TInterface>() where TTarget : TInterface, IComponent, new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a new component instantiated of the specified type.
|
||||
/// </summary>
|
||||
@@ -285,8 +261,6 @@ namespace Robust.Shared.GameObjects
|
||||
/// A list of type references that can be used to get a reference to an instance of this component,
|
||||
/// for methods like <see cref="IEntity.GetComponent{T}" />.
|
||||
/// These are not unique and can overlap with other components.
|
||||
/// Unlike the other properties, this data is not gotten from a component instance,
|
||||
/// instead this data is set with <see cref="IComponentFactory.RegisterReference{TTarget, TInterface}" />
|
||||
/// </summary>
|
||||
IReadOnlyList<Type> References { get; }
|
||||
}
|
||||
|
||||
@@ -60,14 +60,6 @@ namespace Robust.Shared.Localization
|
||||
/// </summary>
|
||||
CultureInfo? DefaultCulture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Load data for a culture.
|
||||
/// </summary>
|
||||
/// <param name="resourceManager"></param>
|
||||
/// <param name="culture"></param>
|
||||
[Obsolete("Use LoadCulture without IResourceManager overload instead.")]
|
||||
void LoadCulture(IResourceManager resourceManager, CultureInfo culture) => LoadCulture(culture);
|
||||
|
||||
/// <summary>
|
||||
/// Load data for a culture.
|
||||
/// </summary>
|
||||
@@ -87,14 +79,6 @@ namespace Robust.Shared.Localization
|
||||
/// <param name="function">The function itself.</param>
|
||||
void AddFunction(CultureInfo culture, string name, LocFunction function);
|
||||
|
||||
/// <summary>
|
||||
/// Remnants of the old Localization system.
|
||||
/// It exists to prevent source errors and allow existing game text to *mostly* work
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
[StringFormatMethod("text")]
|
||||
string GetString(string text, params object[] args);
|
||||
|
||||
/// <summary>
|
||||
/// Gets localization data for an entity prototype.
|
||||
/// </summary>
|
||||
|
||||
@@ -56,27 +56,5 @@ namespace Robust.Shared.Localization
|
||||
{
|
||||
return LocalizationManager.TryGetString(messageId, out value, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load data for a culture.
|
||||
/// </summary>
|
||||
/// <param name="resourceManager"></param>
|
||||
/// <param name="culture"></param>
|
||||
[Obsolete("Use ILocalizationManager directly for setup methods.")]
|
||||
public static void LoadCulture(IResourceManager resourceManager, CultureInfo culture)
|
||||
{
|
||||
LocalizationManager.LoadCulture(resourceManager, culture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remnants of the old Localization system.
|
||||
/// It exists to prevent source errors and allow existing game text to *mostly* work
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
[StringFormatMethod("text")]
|
||||
public static string GetString(string text, params object[] args)
|
||||
{
|
||||
return LocalizationManager.GetString(text, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,17 +155,6 @@ namespace Robust.Shared.Localization
|
||||
FlushEntityCache();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remnants of the old Localization system.
|
||||
/// It exists to prevent source errors and allow existing game text to *mostly* work
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
[StringFormatMethod("text")]
|
||||
public string GetString(string text, params object[] args)
|
||||
{
|
||||
return string.Format(text, args);
|
||||
}
|
||||
|
||||
public CultureInfo? DefaultCulture
|
||||
{
|
||||
get => _defaultCulture;
|
||||
@@ -272,4 +261,4 @@ namespace Robust.Shared.Localization
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,22 +125,6 @@ namespace Robust.Shared.Map
|
||||
return FromMap(entity, coordinates);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a set of EntityCoordinates given some MapCoordinates.
|
||||
/// </summary>
|
||||
/// <param name="entityManager"></param>
|
||||
/// <param name="mapManager"></param>
|
||||
/// <param name="coordinates"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("Use FromMap(IMapManager mapManager, MapCoordinates coordinates) instead.")]
|
||||
public static EntityCoordinates FromMap(IEntityManager entityManager, IMapManager mapManager, MapCoordinates coordinates)
|
||||
{
|
||||
var mapId = coordinates.MapId;
|
||||
var mapEntity = mapManager.GetMapEntity(mapId);
|
||||
|
||||
return new EntityCoordinates(mapEntity.Uid, coordinates.Position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a set of EntityCoordinates given some MapCoordinates.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Robust.Shared.Map
|
||||
{
|
||||
/// <summary>
|
||||
/// Internal structure to store 2 indices of a chunk or tile.
|
||||
/// <remarks>Despite the name, this can refer to a specific tile on a grid.</remarks>
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
[Serializable, NetSerializable]
|
||||
[Obsolete("Use Vector2i instead")]
|
||||
public readonly struct MapIndices : IEquatable<MapIndices>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="X" /> index.
|
||||
/// </summary>
|
||||
public readonly int X;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Y" /> index.
|
||||
/// </summary>
|
||||
public readonly int Y;
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor.
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="X" /> index.</param>
|
||||
/// <param name="y">The <see cref="Y" /> index.</param>
|
||||
public MapIndices(int x, int y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Translates the indices by a given offset.
|
||||
/// </summary>
|
||||
public static MapIndices operator +(MapIndices left, MapIndices right)
|
||||
{
|
||||
return new(left.X + right.X, left.Y + right.Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Translates the indices by a given offset.
|
||||
/// </summary>
|
||||
public static MapIndices operator -(MapIndices left, MapIndices right)
|
||||
{
|
||||
return new(left.X - right.X, left.Y - right.Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the opposite indices.
|
||||
/// </summary>
|
||||
public static MapIndices operator -(MapIndices indices)
|
||||
{
|
||||
return new(-indices.X, -indices.Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scales the <paramref name="indices" /> by a scalar amount.
|
||||
/// </summary>
|
||||
public static MapIndices operator *(MapIndices indices, int multiplier)
|
||||
{
|
||||
return new(indices.X * multiplier, indices.Y * multiplier);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests for value equality between two LocalCoordinates.
|
||||
/// </summary>
|
||||
public static bool operator ==(MapIndices a, MapIndices b)
|
||||
{
|
||||
return a.Equals(b);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests for value inequality between two LocalCoordinates.
|
||||
/// </summary>
|
||||
public static bool operator !=(MapIndices a, MapIndices b)
|
||||
{
|
||||
return !a.Equals(b);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is MapIndices idx && Equals(idx);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Equals(MapIndices other)
|
||||
{
|
||||
return other.X == X && other.Y == Y;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{{{X},{Y}}}";
|
||||
}
|
||||
|
||||
public EntityCoordinates ToEntityCoordinates(IMapManager mapManager, GridId gridId)
|
||||
{
|
||||
var grid = mapManager.GetGrid(gridId);
|
||||
var tile = grid.TileSize;
|
||||
|
||||
return new EntityCoordinates(grid.GridEntityId, (X * tile, Y * tile));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return X ^ (Y * 23011);
|
||||
}
|
||||
|
||||
public static implicit operator Vector2i(in MapIndices indices)
|
||||
{
|
||||
return new(indices.X, indices.Y);
|
||||
}
|
||||
|
||||
public static implicit operator MapIndices(in Vector2i indices)
|
||||
{
|
||||
return new(indices.X, indices.Y);
|
||||
}
|
||||
|
||||
public static implicit operator Vector2(in MapIndices indices)
|
||||
{
|
||||
return new(indices.X, indices.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using AHelpers = Robust.Shared.AuthLib.UsernameHelpers;
|
||||
|
||||
namespace Robust.Shared.Utility
|
||||
{
|
||||
[Obsolete("Use Robust.Shared.AuthLib.UsernameHelpers instead.")]
|
||||
public static class UsernameHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks whether a user name is valid.
|
||||
/// If this is false, feel free to kick the person requesting it. Loudly.
|
||||
/// </summary>
|
||||
/// <param name="name">The name to check.</param>
|
||||
/// <returns>True if the name is acceptable, false otherwise.</returns>
|
||||
public static (bool, string? reason) IsNameValid(string name)
|
||||
{
|
||||
var valid = AHelpers.IsNameValid(name, out var reason);
|
||||
if (valid)
|
||||
{
|
||||
return (true, null);
|
||||
}
|
||||
|
||||
return (false, reason.ToText());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user