Compare commits

...

3 Commits

Author SHA1 Message Date
metalgearsloth
ff75495894 Version: 182.1.0 2023-11-26 12:45:21 +11:00
metalgearsloth
4cb51af733 Add arch trimming back (#4608) 2023-11-26 12:35:13 +11:00
Leon Friedrich
89c1e90646 Add IRobustRandom.SetSeed() (#4606) 2023-11-25 15:32:16 -08:00
8 changed files with 26 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
<Project>
<!-- This file automatically reset by Tools/version.py -->
<!-- This file automatically reset by Tools/version.py -->

View File

@@ -54,6 +54,17 @@ END TEMPLATE-->
*None yet*
## 182.1.0
### New features
* Add IRobustRandom.SetSeed
### Other
* Add Arch.TrimExcess() back to remove excess archetypes on map load / EntityManager flush.
## 182.0.0
### Breaking changes

View File

@@ -178,7 +178,7 @@ public sealed class MapLoaderSystem : EntitySystem
}
}
// EntityManager.CleanupArch();
EntityManager.CleanupArch();
rootUids = rootEnts;
}

View File

@@ -32,15 +32,14 @@ public partial class EntityManager
protected void DestroyArch(EntityUid uid)
{
var archEnt = (Entity) uid;
var reference = _world.Reference(archEnt);
var reference = _world.Reference(uid);
if (reference.Version != (uid.Version - EntityUid.ArchVersionOffset))
if (!_world.IsAlive(reference))
{
throw new InvalidOperationException($"Tried to delete a different matching entity for Arch.");
throw new InvalidOperationException("Tried to delete an invalid entity reference");
}
_world.Destroy(archEnt);
_world.Destroy(reference);
}
private void SpawnEntityArch(out EntityUid entity)

View File

@@ -603,8 +603,7 @@ namespace Robust.Shared.GameObjects
DeleteEntity(e);
}
// Arch bug atm
// CleanupArch();
CleanupArch();
if (_world.Size > 0)
_sawmill.Error("Entities were spawned while flushing entities.");

View File

@@ -14,6 +14,7 @@ public interface IRobustRandom
/// </summary>
/// <returns></returns>
System.Random GetRandom();
void SetSeed(int seed);
float NextFloat();
public float NextFloat(float minValue, float maxValue)

View File

@@ -5,10 +5,15 @@ namespace Robust.Shared.Random
{
public sealed class RobustRandom : IRobustRandom
{
private readonly System.Random _random = new();
private System.Random _random = new();
public System.Random GetRandom() => _random;
public void SetSeed(int seed)
{
_random = new(seed);
}
public float NextFloat()
{
return _random.NextFloat();