Ghost role probability (#9752)
* Ghost role probability * give it to regular ticks/bears too
This commit is contained in:
@@ -17,6 +17,7 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Ghost.Roles
|
||||
@@ -27,6 +28,7 @@ namespace Content.Server.Ghost.Roles
|
||||
[Dependency] private readonly EuiManager _euiManager = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly FollowerSystem _followerSystem = default!;
|
||||
|
||||
private uint _nextRoleIdentifier;
|
||||
@@ -265,6 +267,12 @@ namespace Content.Server.Ghost.Roles
|
||||
|
||||
private void OnInit(EntityUid uid, GhostRoleComponent role, ComponentInit args)
|
||||
{
|
||||
if (role.Probability < 1f && !_random.Prob(role.Probability))
|
||||
{
|
||||
RemComp<GhostRoleComponent>(uid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (role.RoleRules == "")
|
||||
role.RoleRules = Loc.GetString("ghost-role-component-default-rules");
|
||||
RegisterGhostRole(role);
|
||||
|
||||
Reference in New Issue
Block a user