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")]
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("makeSentient")]
|
||||||
protected bool MakeSentient = true;
|
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.
|
// We do this so updating RoleName and RoleDescription in VV updates the open EUIs.
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.Ghost.Roles
|
namespace Content.Server.Ghost.Roles
|
||||||
@@ -27,6 +28,7 @@ namespace Content.Server.Ghost.Roles
|
|||||||
[Dependency] private readonly EuiManager _euiManager = default!;
|
[Dependency] private readonly EuiManager _euiManager = default!;
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly FollowerSystem _followerSystem = default!;
|
[Dependency] private readonly FollowerSystem _followerSystem = default!;
|
||||||
|
|
||||||
private uint _nextRoleIdentifier;
|
private uint _nextRoleIdentifier;
|
||||||
@@ -265,6 +267,12 @@ namespace Content.Server.Ghost.Roles
|
|||||||
|
|
||||||
private void OnInit(EntityUid uid, GhostRoleComponent role, ComponentInit args)
|
private void OnInit(EntityUid uid, GhostRoleComponent role, ComponentInit args)
|
||||||
{
|
{
|
||||||
|
if (role.Probability < 1f && !_random.Prob(role.Probability))
|
||||||
|
{
|
||||||
|
RemComp<GhostRoleComponent>(uid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (role.RoleRules == "")
|
if (role.RoleRules == "")
|
||||||
role.RoleRules = Loc.GetString("ghost-role-component-default-rules");
|
role.RoleRules = Loc.GetString("ghost-role-component-default-rules");
|
||||||
RegisterGhostRole(role);
|
RegisterGhostRole(role);
|
||||||
|
|||||||
@@ -2231,43 +2231,43 @@ entities:
|
|||||||
- canCollide: False
|
- canCollide: False
|
||||||
type: Physics
|
type: Physics
|
||||||
- uid: 212
|
- uid: 212
|
||||||
type: SpawnMobBear
|
type: SpawnMobBearSalvage
|
||||||
components:
|
components:
|
||||||
- pos: 6.5,-5.5
|
- pos: 6.5,-5.5
|
||||||
parent: 0
|
parent: 0
|
||||||
type: Transform
|
type: Transform
|
||||||
- uid: 213
|
- uid: 213
|
||||||
type: SpawnMobBear
|
type: SpawnMobBearSalvage
|
||||||
components:
|
components:
|
||||||
- pos: 3.5,-6.5
|
- pos: 3.5,-6.5
|
||||||
parent: 0
|
parent: 0
|
||||||
type: Transform
|
type: Transform
|
||||||
- uid: 214
|
- uid: 214
|
||||||
type: SpawnMobBear
|
type: SpawnMobBearSalvage
|
||||||
components:
|
components:
|
||||||
- pos: 4.5,-4.5
|
- pos: 4.5,-4.5
|
||||||
parent: 0
|
parent: 0
|
||||||
type: Transform
|
type: Transform
|
||||||
- uid: 215
|
- uid: 215
|
||||||
type: SpawnMobBear
|
type: SpawnMobBearSalvage
|
||||||
components:
|
components:
|
||||||
- pos: 8.5,-4.5
|
- pos: 8.5,-4.5
|
||||||
parent: 0
|
parent: 0
|
||||||
type: Transform
|
type: Transform
|
||||||
- uid: 216
|
- uid: 216
|
||||||
type: SpawnMobBear
|
type: SpawnMobBearSalvage
|
||||||
components:
|
components:
|
||||||
- pos: 8.5,-6.5
|
- pos: 8.5,-6.5
|
||||||
parent: 0
|
parent: 0
|
||||||
type: Transform
|
type: Transform
|
||||||
- uid: 217
|
- uid: 217
|
||||||
type: SpawnMobBear
|
type: SpawnMobBearSalvage
|
||||||
components:
|
components:
|
||||||
- pos: 1.5,-2.5
|
- pos: 1.5,-2.5
|
||||||
parent: 0
|
parent: 0
|
||||||
type: Transform
|
type: Transform
|
||||||
- uid: 218
|
- uid: 218
|
||||||
type: SpawnMobBear
|
type: SpawnMobBearSalvage
|
||||||
components:
|
components:
|
||||||
- pos: 5.5,-9.5
|
- pos: 5.5,-9.5
|
||||||
parent: 0
|
parent: 0
|
||||||
@@ -2606,7 +2606,7 @@ entities:
|
|||||||
light_bulb: !type:ContainerSlot {}
|
light_bulb: !type:ContainerSlot {}
|
||||||
type: ContainerContainer
|
type: ContainerContainer
|
||||||
- uid: 254
|
- uid: 254
|
||||||
type: SpawnMobBear
|
type: SpawnMobBearSalvage
|
||||||
components:
|
components:
|
||||||
- pos: 11.5,-9.5
|
- pos: 11.5,-9.5
|
||||||
parent: 0
|
parent: 0
|
||||||
|
|||||||
@@ -1364,13 +1364,13 @@ entities:
|
|||||||
- solution: drink
|
- solution: drink
|
||||||
type: DrainableSolution
|
type: DrainableSolution
|
||||||
- uid: 127
|
- uid: 127
|
||||||
type: SpawnMobBear
|
type: SpawnMobBearSalvage
|
||||||
components:
|
components:
|
||||||
- pos: -3.5,2.5
|
- pos: -3.5,2.5
|
||||||
parent: 0
|
parent: 0
|
||||||
type: Transform
|
type: Transform
|
||||||
- uid: 128
|
- uid: 128
|
||||||
type: SpawnMobBear
|
type: SpawnMobBearSalvage
|
||||||
components:
|
components:
|
||||||
- pos: 2.5,2.5
|
- pos: 2.5,2.5
|
||||||
parent: 0
|
parent: 0
|
||||||
@@ -2503,7 +2503,7 @@ entities:
|
|||||||
ents: []
|
ents: []
|
||||||
type: ContainerContainer
|
type: ContainerContainer
|
||||||
- uid: 280
|
- uid: 280
|
||||||
type: SpawnMobBear
|
type: SpawnMobBearSalvage
|
||||||
components:
|
components:
|
||||||
- rot: 3.141592653589793 rad
|
- rot: 3.141592653589793 rad
|
||||||
pos: 8.5,7.5
|
pos: 8.5,7.5
|
||||||
|
|||||||
@@ -86,6 +86,20 @@
|
|||||||
prototypes:
|
prototypes:
|
||||||
- MobTickSalvage
|
- 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
|
- type: entity
|
||||||
id: SalvageMobSpawner75
|
id: SalvageMobSpawner75
|
||||||
parent: SalvageMobSpawner
|
parent: SalvageMobSpawner
|
||||||
|
|||||||
@@ -69,3 +69,20 @@
|
|||||||
Brute: 15
|
Brute: 15
|
||||||
- type: ReplacementAccent
|
- type: ReplacementAccent
|
||||||
accent: genericAggressive
|
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"
|
suffix: "Salvage Ruleset"
|
||||||
components:
|
components:
|
||||||
- type: GhostTakeoverAvailable
|
- type: GhostTakeoverAvailable
|
||||||
|
prob: 0.33
|
||||||
name: space carp on salvage wreck
|
name: space carp on salvage wreck
|
||||||
description: |
|
description: |
|
||||||
Defend the loot inside the salvage wreck!
|
Defend the loot inside the salvage wreck!
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
- type: SolutionTransfer
|
- type: SolutionTransfer
|
||||||
maxTransferAmount: 5
|
maxTransferAmount: 5
|
||||||
- type: GhostTakeoverAvailable
|
- type: GhostTakeoverAvailable
|
||||||
|
prob: 0.33
|
||||||
makeSentient: true
|
makeSentient: true
|
||||||
name: space tick
|
name: space tick
|
||||||
description: |
|
description: |
|
||||||
|
|||||||
Reference in New Issue
Block a user