fix: auto-update mailing unit + gas canister UIs on state (#39289)
* fix: auto-update mailing unit + gas canister UIs * fix: make FollowerComponent auto handle state * refactor: kill AfterAutoHandleState for Follower * flakeops
This commit is contained in:
@@ -6,7 +6,7 @@ using Robust.Shared.GameStates;
|
|||||||
|
|
||||||
namespace Content.Shared.Atmos.Piping.Unary.Components;
|
namespace Content.Shared.Atmos.Piping.Unary.Components;
|
||||||
|
|
||||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
|
||||||
public sealed partial class GasCanisterComponent : Component, IGasMixtureHolder
|
public sealed partial class GasCanisterComponent : Component, IGasMixtureHolder
|
||||||
{
|
{
|
||||||
[DataField("port")]
|
[DataField("port")]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Content.Shared.Configurable
|
|||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// If you want a more detailed description ask the original coder.
|
/// If you want a more detailed description ask the original coder.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
|
||||||
public sealed partial class ConfigurationComponent : Component
|
public sealed partial class ConfigurationComponent : Component
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace Content.Shared.Follower.Components;
|
|||||||
|
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[Access(typeof(FollowerSystem))]
|
[Access(typeof(FollowerSystem))]
|
||||||
[NetworkedComponent, AutoGenerateComponentState(RaiseAfterAutoHandleState = true)]
|
[NetworkedComponent, AutoGenerateComponentState]
|
||||||
public sealed partial class FollowerComponent : Component
|
public sealed partial class FollowerComponent : Component
|
||||||
{
|
{
|
||||||
[AutoNetworkedField, DataField("following")]
|
[AutoNetworkedField, DataField("following")]
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ public sealed class FollowerSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<FollowerComponent, MoveInputEvent>(OnFollowerMove);
|
SubscribeLocalEvent<FollowerComponent, MoveInputEvent>(OnFollowerMove);
|
||||||
SubscribeLocalEvent<FollowerComponent, PullStartedMessage>(OnPullStarted);
|
SubscribeLocalEvent<FollowerComponent, PullStartedMessage>(OnPullStarted);
|
||||||
SubscribeLocalEvent<FollowerComponent, EntityTerminatingEvent>(OnFollowerTerminating);
|
SubscribeLocalEvent<FollowerComponent, EntityTerminatingEvent>(OnFollowerTerminating);
|
||||||
SubscribeLocalEvent<FollowerComponent, AfterAutoHandleStateEvent>(OnAfterHandleState);
|
|
||||||
|
|
||||||
SubscribeLocalEvent<FollowedComponent, ComponentGetStateAttemptEvent>(OnFollowedAttempt);
|
SubscribeLocalEvent<FollowedComponent, ComponentGetStateAttemptEvent>(OnFollowedAttempt);
|
||||||
SubscribeLocalEvent<FollowerComponent, GotEquippedHandEvent>(OnGotEquippedHand);
|
SubscribeLocalEvent<FollowerComponent, GotEquippedHandEvent>(OnGotEquippedHand);
|
||||||
@@ -150,11 +149,6 @@ public sealed class FollowerSystem : EntitySystem
|
|||||||
StopFollowingEntity(uid, component.Following, deparent: false);
|
StopFollowingEntity(uid, component.Following, deparent: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAfterHandleState(Entity<FollowerComponent> entity, ref AfterAutoHandleStateEvent args)
|
|
||||||
{
|
|
||||||
StartFollowingEntity(entity, entity.Comp.Following);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since we parent our observer to the followed entity, we need to detach
|
// Since we parent our observer to the followed entity, we need to detach
|
||||||
// before they get deleted so that we don't get recursively deleted too.
|
// before they get deleted so that we don't get recursively deleted too.
|
||||||
private void OnFollowedTerminating(EntityUid uid, FollowedComponent component, ref EntityTerminatingEvent args)
|
private void OnFollowedTerminating(EntityUid uid, FollowedComponent component, ref EntityTerminatingEvent args)
|
||||||
|
|||||||
Reference in New Issue
Block a user