PlayerPanel Follow button (#36466)

* Follow button

* remove event stuff
This commit is contained in:
Errant
2025-04-12 22:00:46 +02:00
committed by GitHub
parent 76e72893c9
commit 0c6e21dec2
6 changed files with 24 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ using Content.Server.EUI;
using Content.Shared.Administration;
using Content.Shared.Database;
using Content.Shared.Eui;
using Content.Shared.Follower;
using Robust.Server.Player;
using Robust.Shared.Player;
@@ -33,11 +34,13 @@ public sealed class PlayerPanelEui : BaseEui
private bool _frozen;
private bool _canFreeze;
private bool _canAhelp;
private FollowerSystem _follower;
public PlayerPanelEui(LocatedPlayerData player)
{
IoCManager.InjectDependencies(this);
_targetPlayer = player;
_follower = _entity.System<FollowerSystem>();
}
public override void Opened()
@@ -141,6 +144,16 @@ public sealed class PlayerPanelEui : BaseEui
_entity.DeleteEntity(session.AttachedEntity);
}
break;
case PlayerPanelFollowMessage:
if (!_admins.HasAdminFlag(Player, AdminFlags.Admin) ||
!_player.TryGetSessionById(_targetPlayer.UserId, out session) ||
session.AttachedEntity == null ||
Player.AttachedEntity is null ||
session.AttachedEntity == Player.AttachedEntity)
return;
_follower.StartFollowingEntity(Player.AttachedEntity.Value, session.AttachedEntity.Value);
break;
}
}