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;
|
namespace Content.Server.ImmovableRod;
|
||||||
|
|
||||||
@@ -13,12 +13,6 @@ public sealed class ImmovableRodComponent : Component
|
|||||||
[DataField("hitSoundProbability")]
|
[DataField("hitSoundProbability")]
|
||||||
public float HitSoundProbability = 0.1f;
|
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")]
|
[DataField("minSpeed")]
|
||||||
public float MinSpeed = 10f;
|
public float MinSpeed = 10f;
|
||||||
|
|
||||||
@@ -42,7 +36,4 @@ public sealed class ImmovableRodComponent : Component
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("destroyTiles")]
|
[DataField("destroyTiles")]
|
||||||
public bool DestroyTiles = true;
|
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.Server.Popups;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
@@ -23,14 +23,6 @@ public sealed class ImmovableRodSystem : EntitySystem
|
|||||||
// we are deliberately including paused entities. rod hungers for all
|
// we are deliberately including paused entities. rod hungers for all
|
||||||
foreach (var (rod, trans) in EntityManager.EntityQuery<ImmovableRodComponent, TransformComponent>(true))
|
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)
|
if (!rod.DestroyTiles)
|
||||||
continue;
|
continue;
|
||||||
if (!_map.TryGetGrid(trans.GridID, out var grid))
|
if (!_map.TryGetGrid(trans.GridID, out var grid))
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
state: icon
|
state: icon
|
||||||
noRot: false
|
noRot: false
|
||||||
- type: ImmovableRod
|
- type: ImmovableRod
|
||||||
|
- type: TimedDespawn
|
||||||
|
lifetime: 30.0
|
||||||
- type: Physics
|
- type: Physics
|
||||||
bodyType: Dynamic
|
bodyType: Dynamic
|
||||||
linearDamping: 0
|
linearDamping: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user