mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 11:40:52 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e44e4ac7ed | ||
|
|
581ef074a0 | ||
|
|
9bb61b8a35 | ||
|
|
e7497c7e4f | ||
|
|
7bc54d8f73 | ||
|
|
1631d93e41 |
@@ -1,4 +1,4 @@
|
||||
<Project>
|
||||
|
||||
<!-- This file automatically reset by Tools/version.py -->
|
||||
<!-- This file automatically reset by Tools/version.py -->
|
||||
|
||||
|
||||
@@ -54,6 +54,22 @@ END TEMPLATE-->
|
||||
*None yet*
|
||||
|
||||
|
||||
## 131.1.0
|
||||
|
||||
### New features
|
||||
|
||||
* Add NextByte method to random.
|
||||
* Add method to get a random tile variant.
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* Fix replay component state bug.
|
||||
|
||||
### Internal
|
||||
|
||||
* Remove some AggressiveOptimization attributes.
|
||||
|
||||
|
||||
## 131.0.0
|
||||
|
||||
### Breaking changes
|
||||
|
||||
@@ -331,7 +331,7 @@ public sealed partial class ReplayLoadManager
|
||||
{
|
||||
var existing = combined[index];
|
||||
|
||||
if (!newCompStates.TryGetValue(existing.NetID, out var newCompState))
|
||||
if (!newCompStates.Remove(existing.NetID, out var newCompState))
|
||||
continue;
|
||||
|
||||
if (newCompState.State is not IComponentDeltaState delta || delta.FullState)
|
||||
@@ -344,6 +344,14 @@ public sealed partial class ReplayLoadManager
|
||||
combined[index] = new ComponentChange(existing.NetID, delta.CreateNewFullState(existing.State), newCompState.LastModifiedTick);
|
||||
}
|
||||
|
||||
foreach (var compChange in newCompStates.Values)
|
||||
{
|
||||
// I'm not 100% sure about this, but I think delta states should always be full states here?
|
||||
DebugTools.Assert(compChange.State is not IComponentDeltaState delta || delta.FullState);
|
||||
combined.Add(compChange);
|
||||
}
|
||||
|
||||
DebugTools.Assert(newState.NetComponents == null || newState.NetComponents.Count == combined.Count);
|
||||
return new EntityState(newState.Uid, combined, newState.EntityLastModified, newState.NetComponents ?? oldNetComps);
|
||||
}
|
||||
|
||||
|
||||
@@ -851,7 +851,6 @@ internal sealed partial class PvsSystem : EntitySystem
|
||||
return leftView.Count > 0 ? leftView : null;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
|
||||
private void RecursivelyAddTreeNode(in EntityUid nodeIndex,
|
||||
RobustTree<EntityUid> tree,
|
||||
Dictionary<EntityUid, PvsEntityVisibility>? lastAcked,
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Robust.Shared.Maths
|
||||
/// <summary>
|
||||
/// Adds scalar b to a and stores the result in a.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Add(Span<float> a, float b)
|
||||
{
|
||||
Add(a, b, a);
|
||||
@@ -110,7 +110,7 @@ namespace Robust.Shared.Maths
|
||||
/// <summary>
|
||||
/// Adds scalar b to a and stores the result in s.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Add(ReadOnlySpan<float> a, float b, Span<float> s)
|
||||
{
|
||||
if (a.Length != s.Length)
|
||||
@@ -125,7 +125,7 @@ namespace Robust.Shared.Maths
|
||||
Add128(a, b, s);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void AddScalar(ReadOnlySpan<float> a, float b, Span<float> s, int start, int end)
|
||||
{
|
||||
for (var i = start; i < end; i++)
|
||||
@@ -134,7 +134,7 @@ namespace Robust.Shared.Maths
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void Add128(ReadOnlySpan<float> a, float b, Span<float> s)
|
||||
{
|
||||
var remainder = a.Length & (Vector128<float>.Count - 1);
|
||||
@@ -159,7 +159,7 @@ namespace Robust.Shared.Maths
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void Add256(ReadOnlySpan<float> a, float b, Span<float> s)
|
||||
{
|
||||
var remainder = a.Length & (Vector256<float>.Count - 1);
|
||||
@@ -191,7 +191,7 @@ namespace Robust.Shared.Maths
|
||||
/// <summary>
|
||||
/// Adds all elements of a and returns the value.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float HorizontalAdd(ReadOnlySpan<float> a)
|
||||
{
|
||||
if (Vector256Enabled && LengthValid256Single(a.Length))
|
||||
@@ -202,7 +202,7 @@ namespace Robust.Shared.Maths
|
||||
return HorizontalAdd128(a);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static float HorizontalAddScalar(ReadOnlySpan<float> a, int start, int end)
|
||||
{
|
||||
var sum = 0f;
|
||||
@@ -215,7 +215,7 @@ namespace Robust.Shared.Maths
|
||||
return sum;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static float HorizontalAdd128(ReadOnlySpan<float> a)
|
||||
{
|
||||
var remainder = a.Length & 3;
|
||||
@@ -242,7 +242,7 @@ namespace Robust.Shared.Maths
|
||||
return sum;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static float HorizontalAdd256(ReadOnlySpan<float> a)
|
||||
{
|
||||
var remainder = a.Length & 7;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Robust.Shared.GameObjects
|
||||
/// <param name="logMissing">Whether to log missing components.</param>
|
||||
/// <typeparam name="TComp">The component type to resolve.</typeparam>
|
||||
/// <returns>True if the component is not null or was resolved correctly, false if the component couldn't be resolved.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected bool Resolve<TComp>(EntityUid uid, [NotNullWhen(true)] ref TComp? component, bool logMissing = true)
|
||||
where TComp : IComponent
|
||||
{
|
||||
@@ -42,7 +42,7 @@ namespace Robust.Shared.GameObjects
|
||||
/// <typeparam name="TComp1">The component type to resolve.</typeparam>
|
||||
/// <typeparam name="TComp2">The component type to resolve.</typeparam>
|
||||
/// <returns>True if the components are not null or were resolved correctly, false if any of the component couldn't be resolved.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected bool Resolve<TComp1, TComp2>(EntityUid uid, [NotNullWhen(true)] ref TComp1? comp1, [NotNullWhen(true)] ref TComp2? comp2, bool logMissing = true)
|
||||
where TComp1 : IComponent
|
||||
where TComp2 : IComponent
|
||||
@@ -62,7 +62,7 @@ namespace Robust.Shared.GameObjects
|
||||
/// <typeparam name="TComp2">The component type to resolve.</typeparam>
|
||||
/// <typeparam name="TComp3">The component type to resolve.</typeparam>
|
||||
/// <returns>True if the components are not null or were resolved correctly, false if any of the component couldn't be resolved.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected bool Resolve<TComp1, TComp2, TComp3>(EntityUid uid, [NotNullWhen(true)] ref TComp1? comp1, [NotNullWhen(true)] ref TComp2? comp2, [NotNullWhen(true)] ref TComp3? comp3, bool logMissing = true)
|
||||
where TComp1 : IComponent
|
||||
where TComp2 : IComponent
|
||||
@@ -85,7 +85,7 @@ namespace Robust.Shared.GameObjects
|
||||
/// <typeparam name="TComp3">The component type to resolve.</typeparam>
|
||||
/// <typeparam name="TComp4">The component type to resolve.</typeparam>
|
||||
/// <returns>True if the components are not null or were resolved correctly, false if any of the component couldn't be resolved.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected bool Resolve<TComp1, TComp2, TComp3, TComp4>(EntityUid uid, [NotNullWhen(true)] ref TComp1? comp1, [NotNullWhen(true)] ref TComp2? comp2, [NotNullWhen(true)] ref TComp3? comp3, [NotNullWhen(true)] ref TComp4? comp4, bool logMissing = true)
|
||||
where TComp1 : IComponent
|
||||
where TComp2 : IComponent
|
||||
|
||||
@@ -72,14 +72,14 @@ namespace Robust.Shared.GameObjects
|
||||
return system;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T>([NotNull] ref T? instance)
|
||||
where T : IEntitySystem
|
||||
{
|
||||
_systemDependencyCollection.Resolve(ref instance);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T1, T2>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2)
|
||||
where T1 : IEntitySystem
|
||||
where T2 : IEntitySystem
|
||||
@@ -87,7 +87,7 @@ namespace Robust.Shared.GameObjects
|
||||
_systemDependencyCollection.Resolve(ref instance1, ref instance2);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T1, T2, T3>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2, [NotNull] ref T3? instance3)
|
||||
where T1 : IEntitySystem
|
||||
where T2 : IEntitySystem
|
||||
@@ -96,7 +96,7 @@ namespace Robust.Shared.GameObjects
|
||||
_systemDependencyCollection.Resolve(ref instance1, ref instance2, ref instance3);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T1, T2, T3, T4>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2, [NotNull] ref T3? instance3, [NotNull] ref T4? instance4)
|
||||
where T1 : IEntitySystem
|
||||
where T2 : IEntitySystem
|
||||
|
||||
@@ -332,21 +332,21 @@ namespace Robust.Shared.IoC
|
||||
return (T)ResolveType(typeof(T));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T>([NotNull] ref T? instance)
|
||||
{
|
||||
// Resolve<T>() will either throw or return a concrete instance, therefore we suppress the nullable warning.
|
||||
instance ??= Resolve<T>()!;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T1, T2>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2)
|
||||
{
|
||||
Resolve(ref instance1);
|
||||
Resolve(ref instance2);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T1, T2, T3>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2,
|
||||
[NotNull] ref T3? instance3)
|
||||
{
|
||||
@@ -354,7 +354,7 @@ namespace Robust.Shared.IoC
|
||||
Resolve(ref instance3);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T1, T2, T3, T4>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2,
|
||||
[NotNull] ref T3? instance3, [NotNull] ref T4? instance4)
|
||||
{
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace Robust.Shared.IoC
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Resolve{T}()"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Resolve<T>([NotNull] ref T? instance)
|
||||
{
|
||||
// Do not call into IDependencyCollection immediately for this,
|
||||
@@ -213,7 +213,7 @@ namespace Robust.Shared.IoC
|
||||
/// <summary>
|
||||
/// Resolve two dependencies manually.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Resolve<T1, T2>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2)
|
||||
{
|
||||
DebugTools.Assert(_container.IsValueCreated, NoContextAssert);
|
||||
@@ -225,7 +225,7 @@ namespace Robust.Shared.IoC
|
||||
/// <summary>
|
||||
/// Resolve three dependencies manually.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Resolve<T1, T2, T3>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2, [NotNull] ref T3? instance3)
|
||||
{
|
||||
DebugTools.Assert(_container.IsValueCreated, NoContextAssert);
|
||||
@@ -237,7 +237,7 @@ namespace Robust.Shared.IoC
|
||||
/// <summary>
|
||||
/// Resolve four dependencies manually.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Resolve<T1, T2, T3, T4>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2, [NotNull] ref T3? instance3, [NotNull] ref T4? instance4)
|
||||
{
|
||||
DebugTools.Assert(_container.IsValueCreated, NoContextAssert);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Robust.Shared.Map.Components
|
||||
public sealed class MapComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField(("lightingEnabled"))]
|
||||
[DataField("lightingEnabled")]
|
||||
public bool LightingEnabled { get; set; } = true;
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Robust.Shared.Map
|
||||
{
|
||||
@@ -7,6 +8,14 @@ namespace Robust.Shared.Map
|
||||
/// </summary>
|
||||
public interface ITileDefinitionManager : IEnumerable<ITileDefinition>
|
||||
{
|
||||
Tile GetVariantTile(string name, IRobustRandom random);
|
||||
|
||||
Tile GetVariantTile(string name, System.Random random);
|
||||
|
||||
Tile GetVariantTile(ITileDefinition tileDef, IRobustRandom random);
|
||||
|
||||
Tile GetVariantTile(ITileDefinition tileDef, System.Random random);
|
||||
|
||||
/// <summary>
|
||||
/// Indexer to retrieve a tile definition by name.
|
||||
/// Note: In the presence of tile aliases, this[A].ID does not necessarily equal A.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Robust.Shared.Map
|
||||
{
|
||||
@@ -12,7 +13,6 @@ namespace Robust.Shared.Map
|
||||
protected readonly List<ITileDefinition> TileDefs;
|
||||
private readonly Dictionary<string, ITileDefinition> _tileNames;
|
||||
private readonly Dictionary<string, List<string>> _awaitingAliases;
|
||||
private readonly Dictionary<ITileDefinition, ushort> _tileIds;
|
||||
|
||||
/// <summary>
|
||||
/// Default Constructor.
|
||||
@@ -21,7 +21,6 @@ namespace Robust.Shared.Map
|
||||
{
|
||||
TileDefs = new List<ITileDefinition>();
|
||||
_tileNames = new Dictionary<string, ITileDefinition>();
|
||||
_tileIds = new Dictionary<ITileDefinition, ushort>();
|
||||
_awaitingAliases = new();
|
||||
}
|
||||
|
||||
@@ -45,7 +44,6 @@ namespace Robust.Shared.Map
|
||||
tileDef.AssignTileId(id);
|
||||
TileDefs.Add(tileDef);
|
||||
_tileNames[name] = tileDef;
|
||||
_tileIds[tileDef] = id;
|
||||
|
||||
AliasingHandleDeferred(name);
|
||||
}
|
||||
@@ -87,6 +85,28 @@ namespace Robust.Shared.Map
|
||||
}
|
||||
}
|
||||
|
||||
public Tile GetVariantTile(string name, IRobustRandom random)
|
||||
{
|
||||
var tileDef = this[name];
|
||||
return GetVariantTile(tileDef, random);
|
||||
}
|
||||
|
||||
public Tile GetVariantTile(string name, System.Random random)
|
||||
{
|
||||
var tileDef = this[name];
|
||||
return GetVariantTile(tileDef, random);
|
||||
}
|
||||
|
||||
public Tile GetVariantTile(ITileDefinition tileDef, IRobustRandom random)
|
||||
{
|
||||
return new Tile(tileDef.TileId, variant: random.NextByte(tileDef.Variants));
|
||||
}
|
||||
|
||||
public Tile GetVariantTile(ITileDefinition tileDef, System.Random random)
|
||||
{
|
||||
return new Tile(tileDef.TileId, variant: random.NextByte(tileDef.Variants));
|
||||
}
|
||||
|
||||
public ITileDefinition this[string name] => _tileNames[name];
|
||||
|
||||
public ITileDefinition this[int id] => TileDefs[id];
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Robust.Shared.Physics
|
||||
|
||||
public int MaxBalance
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
var maxBal = 0;
|
||||
@@ -130,7 +130,7 @@ namespace Robust.Shared.Physics
|
||||
|
||||
public float AreaRatio
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
if (_root == Proxy.Free)
|
||||
@@ -387,7 +387,7 @@ namespace Robust.Shared.Physics
|
||||
return _nodes[proxy].Aabb;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private void RemoveLeaf(Proxy leaf)
|
||||
{
|
||||
if (leaf == _root)
|
||||
@@ -562,7 +562,7 @@ namespace Robust.Shared.Physics
|
||||
return cost;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private void Balance(Proxy index)
|
||||
{
|
||||
while (index != Proxy.Free)
|
||||
@@ -755,7 +755,7 @@ namespace Robust.Shared.Physics
|
||||
/// <summary>
|
||||
/// Compute the height of a sub-tree.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private int ComputeHeight(Proxy proxy)
|
||||
{
|
||||
ref var node = ref _nodes[proxy];
|
||||
@@ -770,7 +770,7 @@ namespace Robust.Shared.Physics
|
||||
) + 1;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
public void RebuildBottomUp(int free = 0)
|
||||
{
|
||||
var proxies = new Proxy[NodeCount + free];
|
||||
@@ -909,7 +909,6 @@ namespace Robust.Shared.Physics
|
||||
|
||||
public delegate void FastQueryCallback(ref T userData);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
|
||||
public void FastQuery(ref Box2 aabb, FastQueryCallback callback)
|
||||
{
|
||||
var stack = new GrowableStack<Proxy>(stackalloc Proxy[256]);
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace Robust.Shared.Physics
|
||||
bool ICollection<T>.Remove(T item)
|
||||
=> Remove(item);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
public bool Update(in T item, Box2? newBox = null)
|
||||
{
|
||||
if (!TryGetProxy(item, out var proxy))
|
||||
|
||||
@@ -57,20 +57,11 @@ public interface IBroadPhase<T> : ICollection<T> where T : notnull {
|
||||
|
||||
int Capacity { get; }
|
||||
|
||||
int Height {
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get;
|
||||
}
|
||||
int Height { get; }
|
||||
|
||||
int MaxBalance {
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
get;
|
||||
}
|
||||
int MaxBalance { get; }
|
||||
|
||||
float AreaRatio {
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
get;
|
||||
}
|
||||
float AreaRatio { get; }
|
||||
|
||||
bool Add(in T item, Box2? newAABB = null);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Robust.Shared.Collections;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
@@ -78,6 +79,24 @@ public interface IRobustRandom
|
||||
(list[k], list[n]) = (list[n], list[k]);
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public byte NextByte(byte maxValue)
|
||||
{
|
||||
return NextByte(0, maxValue);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public byte NextByte()
|
||||
{
|
||||
return NextByte(byte.MaxValue);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public byte NextByte(byte minValue, byte maxValue)
|
||||
{
|
||||
return (byte) Next(minValue, maxValue);
|
||||
}
|
||||
}
|
||||
|
||||
public static class RandomHelpers
|
||||
@@ -97,4 +116,22 @@ public static class RandomHelpers
|
||||
{
|
||||
return random.NextDouble() < chance;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static byte NextByte(this System.Random random, byte maxValue)
|
||||
{
|
||||
return NextByte(random, 0, maxValue);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static byte NextByte(this System.Random random)
|
||||
{
|
||||
return NextByte(random, byte.MaxValue);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static byte NextByte(this System.Random random, byte minValue, byte maxValue)
|
||||
{
|
||||
return (byte) random.Next(minValue, maxValue);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user