Removed lifetime handling from ImmovableRod and added TimedDespawnComponent to the prototype instead (#9870)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Content.Shared.Sound;
|
||||
using Content.Shared.Sound;
|
||||
|
||||
namespace Content.Server.ImmovableRod;
|
||||
|
||||
@@ -13,12 +13,6 @@ public sealed class ImmovableRodComponent : Component
|
||||
[DataField("hitSoundProbability")]
|
||||
public float HitSoundProbability = 0.1f;
|
||||
|
||||
/// <summary>
|
||||
/// The rod will be automatically cleaned up after this time.
|
||||
/// </summary>
|
||||
[DataField("lifetime")]
|
||||
public TimeSpan Lifetime = TimeSpan.FromSeconds(30);
|
||||
|
||||
[DataField("minSpeed")]
|
||||
public float MinSpeed = 10f;
|
||||
|
||||
@@ -42,7 +36,4 @@ public sealed class ImmovableRodComponent : Component
|
||||
/// </summary>
|
||||
[DataField("destroyTiles")]
|
||||
public bool DestroyTiles = true;
|
||||
|
||||
[DataField("accumulator")]
|
||||
public float Accumulator = 0f;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Popups;
|
||||
@@ -23,14 +23,6 @@ public sealed class ImmovableRodSystem : EntitySystem
|
||||
// we are deliberately including paused entities. rod hungers for all
|
||||
foreach (var (rod, trans) in EntityManager.EntityQuery<ImmovableRodComponent, TransformComponent>(true))
|
||||
{
|
||||
rod.Accumulator += frameTime;
|
||||
|
||||
if (rod.Accumulator > rod.Lifetime.TotalSeconds)
|
||||
{
|
||||
QueueDel(rod.Owner);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!rod.DestroyTiles)
|
||||
continue;
|
||||
if (!_map.TryGetGrid(trans.GridID, out var grid))
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
state: icon
|
||||
noRot: false
|
||||
- type: ImmovableRod
|
||||
- type: TimedDespawn
|
||||
lifetime: 30.0
|
||||
- type: Physics
|
||||
bodyType: Dynamic
|
||||
linearDamping: 0
|
||||
|
||||
Reference in New Issue
Block a user