Merge branch 'master' of https://github.com/space-wizards/space-station-14 into map-load-refactor

This commit is contained in:
ElectroJr
2025-02-16 16:52:51 +13:00
1624 changed files with 385006 additions and 263837 deletions

View File

@@ -6,7 +6,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Shuttles.Components
{
[RegisterComponent, NetworkedComponent]
[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause]
[Access(typeof(ThrusterSystem))]
public sealed partial class ThrusterComponent : Component
{
@@ -50,11 +50,17 @@ namespace Content.Server.Shuttles.Components
public bool Firing = false;
/// <summary>
/// How often thruster deals damage.
/// </summary>
[DataField]
public TimeSpan FireCooldown = TimeSpan.FromSeconds(2);
/// <summary>
/// Next time we tick damage for anyone colliding.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("nextFire", customTypeSerializer:typeof(TimeOffsetSerializer))]
public TimeSpan NextFire;
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
public TimeSpan NextFire = TimeSpan.Zero;
}
public enum ThrusterType

View File

@@ -323,7 +323,9 @@ public sealed partial class DockingSystem
// If it's a map check no hard collidable anchored entities overlap
if (isMap)
{
foreach (var tile in _mapSystem.GetLocalTilesIntersecting(gridEntity.Owner, gridEntity.Comp, aabb))
var localTiles = _mapSystem.GetLocalTilesEnumerator(gridEntity.Owner, gridEntity.Comp, aabb);
while (localTiles.MoveNext(out var tile))
{
var anchoredEnumerator = _mapSystem.GetAnchoredEntitiesEnumerator(gridEntity.Owner, gridEntity.Comp, tile.GridIndices);

View File

@@ -44,6 +44,7 @@ public sealed class ThrusterSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent<ThrusterComponent, ActivateInWorldEvent>(OnActivateThruster);
SubscribeLocalEvent<ThrusterComponent, ComponentInit>(OnThrusterInit);
SubscribeLocalEvent<ThrusterComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<ThrusterComponent, ComponentShutdown>(OnThrusterShutdown);
SubscribeLocalEvent<ThrusterComponent, PowerChangedEvent>(OnPowerChange);
SubscribeLocalEvent<ThrusterComponent, AnchorStateChangedEvent>(OnAnchorChange);
@@ -245,6 +246,11 @@ public sealed class ThrusterSystem : EntitySystem
}
}
private void OnMapInit(Entity<ThrusterComponent> ent, ref MapInitEvent args)
{
ent.Comp.NextFire = _timing.CurTime + ent.Comp.FireCooldown;
}
private void OnThrusterShutdown(EntityUid uid, ThrusterComponent component, ComponentShutdown args)
{
DisableThruster(uid, component);
@@ -461,10 +467,13 @@ public sealed class ThrusterSystem : EntitySystem
while (query.MoveNext(out var comp))
{
if (!comp.Firing || comp.Colliding.Count == 0 || comp.Damage == null || comp.NextFire < curTime)
if (comp.NextFire > curTime)
continue;
comp.NextFire += TimeSpan.FromSeconds(1);
comp.NextFire += comp.FireCooldown;
if (!comp.Firing || comp.Colliding.Count == 0 || comp.Damage == null)
continue;
foreach (var uid in comp.Colliding.ToArray())
{