Use new ComponentPauseGenerator (#25183)
Also includes some (non critical) changes to the solution file to re-organize the Roslyn components.
This commit is contained in:
committed by
GitHub
parent
2a2324ecaf
commit
e00f74505c
@@ -6,7 +6,7 @@ namespace Content.Server.Tesla.Components;
|
||||
/// <summary>
|
||||
/// Periodically fires electric arcs at surrounding objects.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(LightningArcShooterSystem))]
|
||||
[RegisterComponent, Access(typeof(LightningArcShooterSystem)), AutoGenerateComponentPause]
|
||||
public sealed partial class LightningArcShooterComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
@@ -45,6 +45,7 @@ public sealed partial class LightningArcShooterComponent : Component
|
||||
/// The time, upon reaching which the next batch of lightning bolts will be fired.
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
[AutoPausedField]
|
||||
public TimeSpan NextShootTime;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Server.Tesla.Components;
|
||||
/// <summary>
|
||||
/// The component changes the visual of an object after it is struck by lightning
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(LightningSparkingSystem))]
|
||||
[RegisterComponent, Access(typeof(LightningSparkingSystem)), AutoGenerateComponentPause]
|
||||
public sealed partial class LightningSparkingComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
@@ -20,6 +20,7 @@ public sealed partial class LightningSparkingComponent : Component
|
||||
/// When the spark visual should turn off.
|
||||
/// </summary>
|
||||
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
|
||||
[AutoPausedField]
|
||||
public TimeSpan LightningEndTime;
|
||||
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
|
||||
@@ -18,7 +18,6 @@ public sealed class LightningArcShooterSystem : EntitySystem
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<LightningArcShooterComponent, MapInitEvent>(OnShooterMapInit);
|
||||
SubscribeLocalEvent<LightningArcShooterComponent, EntityUnpausedEvent>(OnShooterUnpaused);
|
||||
}
|
||||
|
||||
private void OnShooterMapInit(EntityUid uid, LightningArcShooterComponent component, ref MapInitEvent args)
|
||||
@@ -26,11 +25,6 @@ public sealed class LightningArcShooterSystem : EntitySystem
|
||||
component.NextShootTime = _gameTiming.CurTime + TimeSpan.FromSeconds(component.ShootMaxInterval);
|
||||
}
|
||||
|
||||
private void OnShooterUnpaused(EntityUid uid, LightningArcShooterComponent component, ref EntityUnpausedEvent args)
|
||||
{
|
||||
component.NextShootTime += args.PausedTime;
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
@@ -18,12 +18,6 @@ public sealed class LightningSparkingSystem : EntitySystem
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<LightningSparkingComponent, HitByLightningEvent>(OnHitByLightning);
|
||||
SubscribeLocalEvent<LightningSparkingComponent, EntityUnpausedEvent>(OnLightningUnpaused);
|
||||
}
|
||||
|
||||
private void OnLightningUnpaused(EntityUid uid, LightningSparkingComponent component, ref EntityUnpausedEvent args)
|
||||
{
|
||||
component.LightningEndTime += args.PausedTime;
|
||||
}
|
||||
|
||||
private void OnHitByLightning(Entity<LightningSparkingComponent> uid, ref HitByLightningEvent args)
|
||||
|
||||
Reference in New Issue
Block a user