Grouped ghost roles and jump button (#7300)

This commit is contained in:
Alex Evgrashin
2022-04-03 01:06:29 +03:00
committed by GitHub
parent 31a9cc0acb
commit bf89483e09
10 changed files with 91 additions and 21 deletions

View File

@@ -10,6 +10,7 @@ using Content.Server.MobState.States;
using Content.Server.Players;
using Content.Shared.Administration;
using Content.Shared.Database;
using Content.Shared.Follower;
using Content.Shared.GameTicking;
using Content.Shared.Ghost;
using Content.Shared.Ghost.Roles;
@@ -32,6 +33,7 @@ namespace Content.Server.Ghost.Roles
[Dependency] private readonly EuiManager _euiManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!;
[Dependency] private readonly FollowerSystem _followerSystem = default!;
private uint _nextRoleIdentifier;
private bool _needsUpdateGhostRoleCount = true;
@@ -188,6 +190,14 @@ namespace Content.Server.Ghost.Roles
CloseEui(player);
}
public void Follow(IPlayerSession player, uint identifier)
{
if (!_ghostRoles.TryGetValue(identifier, out var role)) return;
if (player.AttachedEntity == null) return;
_followerSystem.StartFollowingEntity(player.AttachedEntity.Value, role.Owner);
}
public void GhostRoleInternalCreateMindAndTransfer(IPlayerSession player, EntityUid roleUid, EntityUid mob, GhostRoleComponent? role = null)
{
if (!Resolve(roleUid, ref role)) return;