using System.Numerics;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Shared.Animations;
using Robust.Shared.Map;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
namespace Content.Client.Animations
{
using Content.Shared.Smoking;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Shared.Network;
<ProjectReference Include="..\RobustToolbox\Robust.Client\Robust.Client.csproj" />
<ProjectReference Include="..\Content.Shared\Content.Shared.csproj" />
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="Spawners\" />
+ </ItemGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
<Import Project="..\RobustToolbox\MSBuild\XamlIL.targets" />
</Project>
using Content.Shared.Projectiles;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Shared.GameStates;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
namespace Content.Client.Projectiles;
using System.Numerics;
using Content.Shared.Salvage.Fulton;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using JetBrains.Annotations;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Shared.Animations;
using Robust.Shared.Serialization.Manager;
using Robust.Shared.Utility;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
namespace Content.Client.Salvage;
+++ /dev/null
-using Content.Shared.Spawners.EntitySystems;
-
-namespace Content.Client.Spawners;
-
-public sealed class TimedDespawnSystem : SharedTimedDespawnSystem
-{
- protected override bool CanDelete(EntityUid uid)
- {
- return IsClientSide(uid);
- }
-}
using Content.Client.Weapons.Ranged.Components;
using Content.Shared.Camera;
using Content.Shared.CombatMode;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using Content.Shared.Weapons.Ranged;
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Weapons.Ranged.Events;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using SharedGunSystem = Content.Shared.Weapons.Ranged.Systems.SharedGunSystem;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
namespace Content.Client.Weapons.Ranged.Systems;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Content.Shared.Physics;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using Content.Shared.Throwing;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Prototypes;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
namespace Content.Server.Chemistry.EntitySystems
{
using Content.Shared.Mind.Components;
using Content.Shared.Physics;
using Content.Shared.Projectiles;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using Content.Shared.Tag;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Random;
using Robust.Shared.Timing;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
namespace Content.Server.Explosion.EntitySystems;
using Content.Shared.Database;
using Content.Shared.FixedPoint;
using Content.Shared.Smoking;
-using Content.Shared.Spawners;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
+using Robust.Shared.Spawners;
using Robust.Shared.Timing;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
namespace Content.Server.Fluids.EntitySystems;
using Content.Shared.Magic.Events;
using Content.Shared.Maps;
using Content.Shared.Physics;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using Content.Shared.Storage;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Content.Shared.Mobs.Components;
using Content.Shared.Movement.Components;
using Content.Shared.Shuttles.Components;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using Content.Shared.Tiles;
using Robust.Server.GameObjects;
using Robust.Shared.Collections;
using Robust.Shared.Map;
using Robust.Shared.Random;
using Robust.Shared.Timing;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
namespace Content.Server.Shuttles.Systems;
{
base.Initialize();
SubscribeLocalEvent<TimedSpawnerComponent, ComponentInit>(OnSpawnerInit);
+ SubscribeLocalEvent<TimedSpawnerComponent, ComponentShutdown>(OnTimedSpawnerShutdown);
}
private void OnSpawnerInit(EntityUid uid, TimedSpawnerComponent component, ComponentInit args)
Spawn(entity, coordinates);
}
}
+
+ private void OnTimedSpawnerShutdown(EntityUid uid, TimedSpawnerComponent component, ComponentShutdown args)
+ {
+ component.TokenSource?.Cancel();
+ }
}
+++ /dev/null
-using Content.Server.Spawners.Components;
-using Content.Shared.Spawners.EntitySystems;
-
-namespace Content.Server.Spawners.EntitySystems;
-
-public sealed class TimedDespawnSystem : SharedTimedDespawnSystem
-{
- public override void Initialize()
- {
- base.Initialize();
- SubscribeLocalEvent<TimedSpawnerComponent, ComponentShutdown>(OnTimedSpawnerShutdown);
- }
-
- private void OnTimedSpawnerShutdown(EntityUid uid, TimedSpawnerComponent component, ComponentShutdown args)
- {
- component.TokenSource?.Cancel();
- }
-
- protected override bool CanDelete(EntityUid uid)
- {
- return true;
- }
-}
using Content.Server.ImmovableRod;
using Content.Server.StationEvents.Components;
using Content.Server.Weapons.Ranged.Systems;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using Robust.Shared.Prototypes;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
namespace Content.Server.StationEvents.Events;
using System.Numerics;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.StationEvents.Components;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using Robust.Shared.Map;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
+using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
namespace Content.Server.StationEvents.Events
{
using Content.Shared.Radiation.Systems;
-using Content.Shared.Spawners.Components;
namespace Content.Shared.Radiation.Components;
/// <summary>
/// How long will animation play in seconds.
- /// Can be overridden by <see cref="TimedDespawnComponent"/>.
+ /// Can be overridden by <see cref="Robust.Shared.Spawners.TimedDespawnComponent"/>.
/// </summary>
public float VisualDuration = 2f;
using Content.Shared.Radiation.Components;
-using Content.Shared.Spawners.Components;
+using Robust.Shared.Spawners;
using Robust.Shared.Timing;
namespace Content.Shared.Radiation.Systems;
}
// try to get radiation range or keep default visual range
if (TryComp<RadiationSourceComponent>(uid, out var radSource))
- {
+ {
component.VisualRange = radSource.Intensity / radSource.Slope;
}
}
+++ /dev/null
-using Robust.Shared.GameStates;
-
-namespace Content.Shared.Spawners.Components;
-
-/// <summary>
-/// Put this component on something you would like to despawn after a certain amount of time
-/// </summary>
-[RegisterComponent]
-public sealed partial class TimedDespawnComponent : Component
-{
- /// <summary>
- /// How long the entity will exist before despawning
- /// </summary>
- [DataField("lifetime")]
- public float Lifetime = 5f;
-}
+++ /dev/null
-using Content.Shared.Spawners.Components;
-using Robust.Shared.GameStates;
-using Robust.Shared.Serialization;
-using Robust.Shared.Timing;
-
-namespace Content.Shared.Spawners.EntitySystems;
-
-public abstract class SharedTimedDespawnSystem : EntitySystem
-{
- [Dependency] private readonly IGameTiming _timing = default!;
-
- public override void Initialize()
- {
- base.Initialize();
- UpdatesOutsidePrediction = true;
- }
-
- public override void Update(float frameTime)
- {
- base.Update(frameTime);
-
- // AAAAAAAAAAAAAAAAAAAAAAAAAAA
- // Client both needs to predict this, but also can't properly handle prediction resetting.
- if (!_timing.IsFirstTimePredicted)
- return;
-
- var query = EntityQueryEnumerator<TimedDespawnComponent>();
-
- while (query.MoveNext(out var uid, out var comp))
- {
- comp.Lifetime -= frameTime;
-
- if (!CanDelete(uid))
- continue;
-
- if (comp.Lifetime <= 0)
- {
- var ev = new TimedDespawnEvent();
- RaiseLocalEvent(uid, ref ev);
- QueueDel(uid);
- }
- }
- }
-
- protected abstract bool CanDelete(EntityUid uid);
-}
+++ /dev/null
-namespace Content.Shared.Spawners;
-
-/// <summary>
-/// Raised directed on an entity when its timed despawn is over.
-/// </summary>
-[ByRefEvent]
-public readonly record struct TimedDespawnEvent;