From 0924193b4809708d059a96ec04a5831582815be4 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Wed, 24 Apr 2024 02:51:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D1=83=D0=B4=D0=B0?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D0=B1=D0=BB=D0=BE=D0=BC?= =?UTF-8?q?=D0=BA=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Worldgen/Prototypes/GCQueuePrototype.cs | 2 +- .../Worldgen/Systems/LocalityLoaderSystem.cs | 28 +++++++++++++++++-- .../Entities/World/Debris/base_debris.yml | 2 ++ Resources/Prototypes/GC/world.yml | 5 ++-- Resources/Prototypes/_NF/Maps/POI/cove.yml | 4 +-- 5 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Content.Server/Worldgen/Prototypes/GCQueuePrototype.cs b/Content.Server/Worldgen/Prototypes/GCQueuePrototype.cs index 94e6cf5fa31..20f7a89e60e 100644 --- a/Content.Server/Worldgen/Prototypes/GCQueuePrototype.cs +++ b/Content.Server/Worldgen/Prototypes/GCQueuePrototype.cs @@ -23,7 +23,7 @@ public sealed class GCQueuePrototype : IPrototype /// The maximum amount of time that can be spent processing this queue. /// [DataField("maximumTickTime")] - public TimeSpan MaximumTickTime { get; } = TimeSpan.FromMilliseconds(1); + public TimeSpan MaximumTickTime { get; } = TimeSpan.FromMilliseconds(5); /// /// The minimum depth before entities in the queue actually get processed for deletion. diff --git a/Content.Server/Worldgen/Systems/LocalityLoaderSystem.cs b/Content.Server/Worldgen/Systems/LocalityLoaderSystem.cs index fb02e8aa0bd..96792fb3eae 100644 --- a/Content.Server/Worldgen/Systems/LocalityLoaderSystem.cs +++ b/Content.Server/Worldgen/Systems/LocalityLoaderSystem.cs @@ -1,5 +1,8 @@ using Content.Server.Worldgen.Components; using Robust.Server.GameObjects; +using Robust.Shared.GameObjects; +using Robust.Shared.Spawners; + namespace Content.Server.Worldgen.Systems; @@ -10,6 +13,9 @@ public sealed class LocalityLoaderSystem : BaseWorldSystem { [Dependency] private readonly TransformSystem _xformSys = default!; + // Duration to reset the despawn timer to when a debris is loaded into a player's view. + private const float DebrisActiveDuration = 360; // 10 минут Corvax + /// public override void Update(float frameTime) { @@ -45,6 +51,9 @@ public override void Update(float frameTime) if ((_xformSys.GetWorldPosition(loaderXform) - _xformSys.GetWorldPosition(xform)).Length() > loadable.LoadingDistance) continue; + // Reset the TimedDespawnComponent's lifetime when loaded + ResetTimedDespawn(uid); + RaiseLocalEvent(uid, new LocalStructureLoadedEvent()); RemCompDeferred(uid); done = true; @@ -54,10 +63,23 @@ public override void Update(float frameTime) } } } + + private void ResetTimedDespawn(EntityUid uid) + { + if (TryComp(uid, out var timedDespawn)) + { + timedDespawn.Lifetime = DebrisActiveDuration; + } + else + { + // Add TimedDespawnComponent if it does not exist + timedDespawn = AddComp(uid); + timedDespawn.Lifetime = DebrisActiveDuration; + } + } } /// -/// A directed fired on a loadable entity when a local loader enters it's vicinity. +/// An event fired on a loadable entity when a local loader enters its vicinity. /// -public record struct LocalStructureLoadedEvent; - +public record struct LocalStructureLoadedEvent; \ No newline at end of file diff --git a/Resources/Prototypes/Entities/World/Debris/base_debris.yml b/Resources/Prototypes/Entities/World/Debris/base_debris.yml index c125d991fd4..b31e94f8639 100644 --- a/Resources/Prototypes/Entities/World/Debris/base_debris.yml +++ b/Resources/Prototypes/Entities/World/Debris/base_debris.yml @@ -4,3 +4,5 @@ components: - type: OwnedDebris - type: LocalityLoader + - type: TimedDespawn + lifetime: 120 \ No newline at end of file diff --git a/Resources/Prototypes/GC/world.yml b/Resources/Prototypes/GC/world.yml index b58a68158cc..ff5885ef700 100644 --- a/Resources/Prototypes/GC/world.yml +++ b/Resources/Prototypes/GC/world.yml @@ -1,4 +1,5 @@ - type: gcQueue id: SpaceDebris - depth: 512 # So there's a decent bit of time before roids unload. - minDepthToProcess: 256 + depth: 256 # Corvax + minDepthToProcess: 128 # Corvax + trySkipQueue: true # Попытка немедленного удаления, если это возможно diff --git a/Resources/Prototypes/_NF/Maps/POI/cove.yml b/Resources/Prototypes/_NF/Maps/POI/cove.yml index 03e102b2ad5..d3657520692 100644 --- a/Resources/Prototypes/_NF/Maps/POI/cove.yml +++ b/Resources/Prototypes/_NF/Maps/POI/cove.yml @@ -12,5 +12,5 @@ - type: StationJobs overflowJobs: [] availableJobs: - PirateCaptain: [ 0, 0 ] - PirateFirstMate: [ 0, 0 ] + PirateCaptain: [ 1, 1 ] + PirateFirstMate: [ 2, 2 ]