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
@@ -10,6 +10,7 @@ namespace Content.Shared.Weapons.Marker;
|
||||
/// Marks an entity to take additional damage
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedDamageMarkerSystem))]
|
||||
[AutoGenerateComponentPause]
|
||||
public sealed partial class DamageMarkerComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
@@ -34,5 +35,6 @@ public sealed partial class DamageMarkerComponent : Component
|
||||
public EntityUid Marker;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("endTime", customTypeSerializer:typeof(TimeOffsetSerializer)), AutoNetworkedField]
|
||||
[AutoPausedField]
|
||||
public TimeSpan EndTime;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ public abstract class SharedDamageMarkerSystem : EntitySystem
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<DamageMarkerOnCollideComponent, StartCollideEvent>(OnMarkerCollide);
|
||||
SubscribeLocalEvent<DamageMarkerComponent, EntityUnpausedEvent>(OnMarkerUnpaused);
|
||||
SubscribeLocalEvent<DamageMarkerComponent, AttackedEvent>(OnMarkerAttacked);
|
||||
}
|
||||
|
||||
@@ -54,11 +53,6 @@ public abstract class SharedDamageMarkerSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMarkerUnpaused(EntityUid uid, DamageMarkerComponent component, ref EntityUnpausedEvent args)
|
||||
{
|
||||
component.EndTime += args.PausedTime;
|
||||
}
|
||||
|
||||
private void OnMarkerCollide(EntityUid uid, DamageMarkerOnCollideComponent component, ref StartCollideEvent args)
|
||||
{
|
||||
if (!args.OtherFixture.Hard ||
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Shared.Weapons.Melee;
|
||||
/// <summary>
|
||||
/// When given to a mob lets them do unarmed attacks, or when given to an item lets someone wield it to do attacks.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause]
|
||||
public sealed partial class MeleeWeaponComponent : Component
|
||||
{
|
||||
// TODO: This is becoming bloated as shit.
|
||||
@@ -33,6 +33,7 @@ public sealed partial class MeleeWeaponComponent : Component
|
||||
/// </summary>
|
||||
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[AutoPausedField]
|
||||
public TimeSpan NextAttack;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -68,7 +68,6 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<MeleeWeaponComponent, EntityUnpausedEvent>(OnMeleeUnpaused);
|
||||
SubscribeLocalEvent<MeleeWeaponComponent, HandSelectedEvent>(OnMeleeSelected);
|
||||
SubscribeLocalEvent<MeleeWeaponComponent, ShotAttemptedEvent>(OnMeleeShotAttempted);
|
||||
SubscribeLocalEvent<MeleeWeaponComponent, GunShotEvent>(OnMeleeShot);
|
||||
@@ -112,11 +111,6 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMeleeUnpaused(EntityUid uid, MeleeWeaponComponent component, ref EntityUnpausedEvent args)
|
||||
{
|
||||
component.NextAttack += args.PausedTime;
|
||||
}
|
||||
|
||||
private void OnMeleeSelected(EntityUid uid, MeleeWeaponComponent component, HandSelectedEvent args)
|
||||
{
|
||||
var attackRate = GetAttackRate(uid, args.User, component);
|
||||
|
||||
@@ -9,7 +9,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
namespace Content.Shared.Weapons.Ranged.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause]
|
||||
[Access(typeof(SharedGunSystem))]
|
||||
public sealed partial class GunComponent : Component
|
||||
{
|
||||
@@ -198,6 +198,7 @@ public sealed partial class GunComponent : Component
|
||||
/// </summary>
|
||||
[DataField(customTypeSerializer:typeof(TimeOffsetSerializer))]
|
||||
[AutoNetworkedField]
|
||||
[AutoPausedField]
|
||||
public TimeSpan NextFire = TimeSpan.Zero;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Weapons.Ranged.Components;
|
||||
/// <summary>
|
||||
/// Responsible for handling recharging a basic entity ammo provider over time.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause]
|
||||
public sealed partial class RechargeBasicEntityAmmoComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -25,5 +25,6 @@ public sealed partial class RechargeBasicEntityAmmoComponent : Component
|
||||
[ViewVariables(VVAccess.ReadWrite),
|
||||
DataField("nextCharge", customTypeSerializer:typeof(TimeOffsetSerializer)),
|
||||
AutoNetworkedField]
|
||||
[AutoPausedField]
|
||||
public TimeSpan? NextCharge;
|
||||
}
|
||||
|
||||
@@ -21,19 +21,10 @@ public sealed class RechargeBasicEntityAmmoSystem : EntitySystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<RechargeBasicEntityAmmoComponent, EntityUnpausedEvent>(OnUnpaused);
|
||||
SubscribeLocalEvent<RechargeBasicEntityAmmoComponent, MapInitEvent>(OnInit);
|
||||
SubscribeLocalEvent<RechargeBasicEntityAmmoComponent, ExaminedEvent>(OnExamined);
|
||||
}
|
||||
|
||||
private void OnUnpaused(EntityUid uid, RechargeBasicEntityAmmoComponent component, ref EntityUnpausedEvent args)
|
||||
{
|
||||
if (component.NextCharge == null)
|
||||
return;
|
||||
|
||||
component.NextCharge = component.NextCharge.Value + args.PausedTime;
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
@@ -94,7 +94,6 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
SubscribeLocalEvent<GunComponent, ExaminedEvent>(OnExamine);
|
||||
SubscribeLocalEvent<GunComponent, CycleModeEvent>(OnCycleMode);
|
||||
SubscribeLocalEvent<GunComponent, HandSelectedEvent>(OnGunSelected);
|
||||
SubscribeLocalEvent<GunComponent, EntityUnpausedEvent>(OnGunUnpaused);
|
||||
SubscribeLocalEvent<GunComponent, MapInitEvent>(OnMapInit);
|
||||
}
|
||||
|
||||
@@ -122,11 +121,6 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGunUnpaused(EntityUid uid, GunComponent component, ref EntityUnpausedEvent args)
|
||||
{
|
||||
component.NextFire += args.PausedTime;
|
||||
}
|
||||
|
||||
private void OnShootRequest(RequestShootEvent msg, EntitySessionEventArgs args)
|
||||
{
|
||||
var user = args.SenderSession.AttachedEntity;
|
||||
|
||||
Reference in New Issue
Block a user