Update SharedBuckleSystem to use PopupClient (#31498)

This commit is contained in:
Winkarst
2024-09-15 05:08:54 +03:00
committed by GitHub
parent 823511c517
commit 62eaae6504
2 changed files with 25 additions and 24 deletions

View File

@@ -242,8 +242,9 @@ public abstract partial class SharedBuckleSystem
if (_whitelistSystem.IsWhitelistFail(strapComp.Whitelist, buckleUid) || if (_whitelistSystem.IsWhitelistFail(strapComp.Whitelist, buckleUid) ||
_whitelistSystem.IsBlacklistPass(strapComp.Blacklist, buckleUid)) _whitelistSystem.IsBlacklistPass(strapComp.Blacklist, buckleUid))
{ {
if (_netManager.IsServer && popup && user != null) if (popup)
_popup.PopupEntity(Loc.GetString("buckle-component-cannot-fit-message"), user.Value, user.Value, PopupType.Medium); _popup.PopupClient(Loc.GetString("buckle-component-cannot-fit-message"), user, PopupType.Medium);
return false; return false;
} }
@@ -261,23 +262,24 @@ public abstract partial class SharedBuckleSystem
if (user != null && !HasComp<HandsComponent>(user)) if (user != null && !HasComp<HandsComponent>(user))
{ {
// PopupPredicted when if (popup)
if (_netManager.IsServer && popup) _popup.PopupClient(Loc.GetString("buckle-component-no-hands-message"), user);
_popup.PopupEntity(Loc.GetString("buckle-component-no-hands-message"), user.Value, user.Value);
return false; return false;
} }
if (buckleComp.Buckled) if (buckleComp.Buckled)
{ {
if (_netManager.IsClient || popup || user == null) if (popup)
return false; {
var message = Loc.GetString(buckleUid == user var message = Loc.GetString(buckleUid == user
? "buckle-component-already-buckled-message" ? "buckle-component-already-buckled-message"
: "buckle-component-other-already-buckled-message", : "buckle-component-other-already-buckled-message",
("owner", Identity.Entity(buckleUid, EntityManager))); ("owner", Identity.Entity(buckleUid, EntityManager)));
_popup.PopupEntity(message, user.Value, user.Value); _popup.PopupClient(message, user);
}
return false; return false;
} }
@@ -291,29 +293,30 @@ public abstract partial class SharedBuckleSystem
continue; continue;
} }
if (_netManager.IsClient || popup || user == null) if (popup)
return false; {
var message = Loc.GetString(buckleUid == user var message = Loc.GetString(buckleUid == user
? "buckle-component-cannot-buckle-message" ? "buckle-component-cannot-buckle-message"
: "buckle-component-other-cannot-buckle-message", : "buckle-component-other-cannot-buckle-message",
("owner", Identity.Entity(buckleUid, EntityManager))); ("owner", Identity.Entity(buckleUid, EntityManager)));
_popup.PopupEntity(message, user.Value, user.Value); _popup.PopupClient(message, user);
}
return false; return false;
} }
if (!StrapHasSpace(strapUid, buckleComp, strapComp)) if (!StrapHasSpace(strapUid, buckleComp, strapComp))
{ {
if (_netManager.IsClient || popup || user == null) if (popup)
return false; {
var message = Loc.GetString(buckleUid == user var message = Loc.GetString(buckleUid == user
? "buckle-component-cannot-fit-message" ? "buckle-component-cannot-buckle-message"
: "buckle-component-other-cannot-fit-message", : "buckle-component-other-cannot-buckle-message",
("owner", Identity.Entity(buckleUid, EntityManager))); ("owner", Identity.Entity(buckleUid, EntityManager)));
_popup.PopupEntity(message, user.Value, user.Value); _popup.PopupClient(message, user);
}
return false; return false;
} }

View File

@@ -9,7 +9,6 @@ using Content.Shared.Rotation;
using Content.Shared.Standing; using Content.Shared.Standing;
using Robust.Shared.Audio.Systems; using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Network;
using Robust.Shared.Physics.Systems; using Robust.Shared.Physics.Systems;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Timing; using Robust.Shared.Timing;
@@ -18,7 +17,6 @@ namespace Content.Shared.Buckle;
public abstract partial class SharedBuckleSystem : EntitySystem public abstract partial class SharedBuckleSystem : EntitySystem
{ {
[Dependency] private readonly INetManager _netManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly ISharedPlayerManager _playerManager = default!; [Dependency] private readonly ISharedPlayerManager _playerManager = default!;