Ghost role probability (#9752)
* Ghost role probability * give it to regular ticks/bears too
This commit is contained in:
@@ -18,6 +18,13 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("makeSentient")]
|
||||
protected bool MakeSentient = true;
|
||||
|
||||
/// <summary>
|
||||
/// The probability that this ghost role will be available after init.
|
||||
/// Used mostly for takeover roles that want some probability of being takeover, but not 100%.
|
||||
/// </summary>
|
||||
[DataField("prob")]
|
||||
public float Probability = 1f;
|
||||
|
||||
// We do this so updating RoleName and RoleDescription in VV updates the open EUIs.
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -2231,43 +2231,43 @@ entities:
|
||||
- canCollide: False
|
||||
type: Physics
|
||||
- uid: 212
|
||||
type: SpawnMobBear
|
||||
type: SpawnMobBearSalvage
|
||||
components:
|
||||
- pos: 6.5,-5.5
|
||||
parent: 0
|
||||
type: Transform
|
||||
- uid: 213
|
||||
type: SpawnMobBear
|
||||
type: SpawnMobBearSalvage
|
||||
components:
|
||||
- pos: 3.5,-6.5
|
||||
parent: 0
|
||||
type: Transform
|
||||
- uid: 214
|
||||
type: SpawnMobBear
|
||||
type: SpawnMobBearSalvage
|
||||
components:
|
||||
- pos: 4.5,-4.5
|
||||
parent: 0
|
||||
type: Transform
|
||||
- uid: 215
|
||||
type: SpawnMobBear
|
||||
type: SpawnMobBearSalvage
|
||||
components:
|
||||
- pos: 8.5,-4.5
|
||||
parent: 0
|
||||
type: Transform
|
||||
- uid: 216
|
||||
type: SpawnMobBear
|
||||
type: SpawnMobBearSalvage
|
||||
components:
|
||||
- pos: 8.5,-6.5
|
||||
parent: 0
|
||||
type: Transform
|
||||
- uid: 217
|
||||
type: SpawnMobBear
|
||||
type: SpawnMobBearSalvage
|
||||
components:
|
||||
- pos: 1.5,-2.5
|
||||
parent: 0
|
||||
type: Transform
|
||||
- uid: 218
|
||||
type: SpawnMobBear
|
||||
type: SpawnMobBearSalvage
|
||||
components:
|
||||
- pos: 5.5,-9.5
|
||||
parent: 0
|
||||
@@ -2606,7 +2606,7 @@ entities:
|
||||
light_bulb: !type:ContainerSlot {}
|
||||
type: ContainerContainer
|
||||
- uid: 254
|
||||
type: SpawnMobBear
|
||||
type: SpawnMobBearSalvage
|
||||
components:
|
||||
- pos: 11.5,-9.5
|
||||
parent: 0
|
||||
|
||||
@@ -1364,13 +1364,13 @@ entities:
|
||||
- solution: drink
|
||||
type: DrainableSolution
|
||||
- uid: 127
|
||||
type: SpawnMobBear
|
||||
type: SpawnMobBearSalvage
|
||||
components:
|
||||
- pos: -3.5,2.5
|
||||
parent: 0
|
||||
type: Transform
|
||||
- uid: 128
|
||||
type: SpawnMobBear
|
||||
type: SpawnMobBearSalvage
|
||||
components:
|
||||
- pos: 2.5,2.5
|
||||
parent: 0
|
||||
@@ -2503,7 +2503,7 @@ entities:
|
||||
ents: []
|
||||
type: ContainerContainer
|
||||
- uid: 280
|
||||
type: SpawnMobBear
|
||||
type: SpawnMobBearSalvage
|
||||
components:
|
||||
- rot: 3.141592653589793 rad
|
||||
pos: 8.5,7.5
|
||||
|
||||
@@ -86,6 +86,20 @@
|
||||
prototypes:
|
||||
- MobTickSalvage
|
||||
|
||||
- type: entity
|
||||
name: Salvage Space Bear Spawner
|
||||
id: SpawnMobBearSalvage
|
||||
parent: MarkerBase
|
||||
components:
|
||||
- type: Sprite
|
||||
layers:
|
||||
- state: green
|
||||
- state: bear
|
||||
sprite: Mobs/Animals/bear.rsi
|
||||
- type: ConditionalSpawner
|
||||
prototypes:
|
||||
- MobBearSpaceSalvage
|
||||
|
||||
- type: entity
|
||||
id: SalvageMobSpawner75
|
||||
parent: SalvageMobSpawner
|
||||
|
||||
@@ -69,3 +69,20 @@
|
||||
Brute: 15
|
||||
- type: ReplacementAccent
|
||||
accent: genericAggressive
|
||||
- type: GhostTakeoverAvailable
|
||||
prob: 0.05
|
||||
name: space bear
|
||||
description: |
|
||||
You're a bear! Do bear things.
|
||||
|
||||
- type: entity
|
||||
id: MobBearSpaceSalvage
|
||||
parent: MobBearSpace
|
||||
suffix: "Salvage Ruleset"
|
||||
components:
|
||||
- type: GhostTakeoverAvailable
|
||||
prob: 0.05
|
||||
name: space bear on salvage wreck
|
||||
description: |
|
||||
Defend the loot inside the salvage wreck!
|
||||
- type: SalvageMobRestrictions
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
suffix: "Salvage Ruleset"
|
||||
components:
|
||||
- type: GhostTakeoverAvailable
|
||||
prob: 0.33
|
||||
name: space carp on salvage wreck
|
||||
description: |
|
||||
Defend the loot inside the salvage wreck!
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
- type: SolutionTransfer
|
||||
maxTransferAmount: 5
|
||||
- type: GhostTakeoverAvailable
|
||||
prob: 0.33
|
||||
makeSentient: true
|
||||
name: space tick
|
||||
description: |
|
||||
|
||||
Reference in New Issue
Block a user