diff --git a/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs b/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs
index 5eed3339b2..e0ca0966c6 100644
--- a/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs
+++ b/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs
@@ -18,6 +18,13 @@ namespace Content.Server.Ghost.Roles.Components
[ViewVariables(VVAccess.ReadWrite)] [DataField("makeSentient")]
protected bool MakeSentient = true;
+ ///
+ /// 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%.
+ ///
+ [DataField("prob")]
+ public float Probability = 1f;
+
// We do this so updating RoleName and RoleDescription in VV updates the open EUIs.
[ViewVariables(VVAccess.ReadWrite)]
diff --git a/Content.Server/Ghost/Roles/GhostRoleSystem.cs b/Content.Server/Ghost/Roles/GhostRoleSystem.cs
index 27c6a754f1..c4be8c8610 100644
--- a/Content.Server/Ghost/Roles/GhostRoleSystem.cs
+++ b/Content.Server/Ghost/Roles/GhostRoleSystem.cs
@@ -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(uid);
+ return;
+ }
+
if (role.RoleRules == "")
role.RoleRules = Loc.GetString("ghost-role-component-default-rules");
RegisterGhostRole(role);
diff --git a/Resources/Maps/Salvage/medium-pet-hospital.yml b/Resources/Maps/Salvage/medium-pet-hospital.yml
index 0f2f789b32..e8472074ca 100644
--- a/Resources/Maps/Salvage/medium-pet-hospital.yml
+++ b/Resources/Maps/Salvage/medium-pet-hospital.yml
@@ -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
diff --git a/Resources/Maps/Salvage/wh-salvage.yml b/Resources/Maps/Salvage/wh-salvage.yml
index 526599b69f..f8b0c1608a 100644
--- a/Resources/Maps/Salvage/wh-salvage.yml
+++ b/Resources/Maps/Salvage/wh-salvage.yml
@@ -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
diff --git a/Resources/Prototypes/Entities/Markers/Spawners/Random/salvage.yml b/Resources/Prototypes/Entities/Markers/Spawners/Random/salvage.yml
index d0203be667..c9b6ed59cd 100644
--- a/Resources/Prototypes/Entities/Markers/Spawners/Random/salvage.yml
+++ b/Resources/Prototypes/Entities/Markers/Spawners/Random/salvage.yml
@@ -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
diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/bear.yml b/Resources/Prototypes/Entities/Mobs/NPCs/bear.yml
index a9e45fea6a..e7ebae664b 100644
--- a/Resources/Prototypes/Entities/Mobs/NPCs/bear.yml
+++ b/Resources/Prototypes/Entities/Mobs/NPCs/bear.yml
@@ -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
diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml b/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml
index 4702a49cdf..5a1a30e33c 100644
--- a/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml
+++ b/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml
@@ -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!
diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/spacetick.yml b/Resources/Prototypes/Entities/Mobs/NPCs/spacetick.yml
index a09ec00d70..fd3c013430 100644
--- a/Resources/Prototypes/Entities/Mobs/NPCs/spacetick.yml
+++ b/Resources/Prototypes/Entities/Mobs/NPCs/spacetick.yml
@@ -78,6 +78,7 @@
- type: SolutionTransfer
maxTransferAmount: 5
- type: GhostTakeoverAvailable
+ prob: 0.33
makeSentient: true
name: space tick
description: |