Restrict ghost role speech/movement to component flags (#11183)

This commit is contained in:
Flipp Syder
2022-09-13 20:46:49 -07:00
committed by GitHub
parent dcd72cccba
commit f9922d9160
11 changed files with 45 additions and 10 deletions

View File

@@ -63,6 +63,14 @@ namespace Content.Server.Ghost.Roles.Components
} }
} }
[DataField("allowSpeech")]
[ViewVariables(VVAccess.ReadWrite)]
public bool AllowSpeech { get; set; } = true;
[DataField("allowMovement")]
[ViewVariables(VVAccess.ReadWrite)]
public bool AllowMovement { get; set; }
[ViewVariables(VVAccess.ReadOnly)] [ViewVariables(VVAccess.ReadOnly)]
public bool Taken { get; set; } public bool Taken { get; set; }

View File

@@ -46,7 +46,7 @@ namespace Content.Server.Ghost.Roles.Components
_entMan.EventBus.RaiseLocalEvent(mob, spawnedEvent, false); _entMan.EventBus.RaiseLocalEvent(mob, spawnedEvent, false);
if (MakeSentient) if (MakeSentient)
MakeSentientCommand.MakeSentient(mob, _entMan); MakeSentientCommand.MakeSentient(mob, _entMan, AllowMovement, AllowSpeech);
mob.EnsureComponent<MindComponent>(); mob.EnsureComponent<MindComponent>();

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Ghost.Roles.Components
return false; return false;
if (MakeSentient) if (MakeSentient)
MakeSentientCommand.MakeSentient(Owner, IoCManager.Resolve<IEntityManager>()); MakeSentientCommand.MakeSentient(Owner, IoCManager.Resolve<IEntityManager>(), AllowMovement, AllowSpeech);
var ghostRoleSystem = EntitySystem.Get<GhostRoleSystem>(); var ghostRoleSystem = EntitySystem.Get<GhostRoleSystem>();
ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, Owner, Owner, this); ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, Owner, Owner, this);

View File

@@ -39,19 +39,27 @@ namespace Content.Server.Mind.Commands
return; return;
} }
MakeSentient(entId, entityManager); MakeSentient(entId, entityManager, true, true);
} }
public static void MakeSentient(EntityUid uid, IEntityManager entityManager) public static void MakeSentient(EntityUid uid, IEntityManager entityManager, bool allowMovement = true, bool allowSpeech = true)
{ {
entityManager.RemoveComponent<NPCComponent>(uid); entityManager.RemoveComponent<NPCComponent>(uid);
entityManager.EnsureComponent<MindComponent>(uid); entityManager.EnsureComponent<MindComponent>(uid);
if (allowMovement)
{
entityManager.EnsureComponent<InputMoverComponent>(uid); entityManager.EnsureComponent<InputMoverComponent>(uid);
entityManager.EnsureComponent<MobMoverComponent>(uid); entityManager.EnsureComponent<MobMoverComponent>(uid);
entityManager.EnsureComponent<MovementSpeedModifierComponent>(uid); entityManager.EnsureComponent<MovementSpeedModifierComponent>(uid);
}
if (allowSpeech)
{
entityManager.EnsureComponent<SharedSpeechComponent>(uid); entityManager.EnsureComponent<SharedSpeechComponent>(uid);
entityManager.EnsureComponent<SharedEmotingComponent>(uid); entityManager.EnsureComponent<SharedEmotingComponent>(uid);
}
entityManager.EnsureComponent<ExaminerComponent>(uid); entityManager.EnsureComponent<ExaminerComponent>(uid);
} }
} }

View File

@@ -29,7 +29,6 @@ public sealed class RandomSentience : StationEventSystem
if (toMakeSentient-- == 0) if (toMakeSentient-- == 0)
break; break;
MakeSentientCommand.MakeSentient(target.Owner, EntityManager);
EntityManager.RemoveComponent<SentienceTargetComponent>(target.Owner); EntityManager.RemoveComponent<SentienceTargetComponent>(target.Owner);
var comp = EntityManager.AddComponent<GhostTakeoverAvailableComponent>(target.Owner); var comp = EntityManager.AddComponent<GhostTakeoverAvailableComponent>(target.Owner);
comp.RoleName = EntityManager.GetComponent<MetaDataComponent>(target.Owner).EntityName; comp.RoleName = EntityManager.GetComponent<MetaDataComponent>(target.Owner).EntityName;

View File

@@ -738,6 +738,8 @@
components: components:
- type: GhostTakeoverAvailable - type: GhostTakeoverAvailable
makeSentient: true makeSentient: true
allowSpeech: true
allowMovement: true
name: ghost-role-information-mouse-name name: ghost-role-information-mouse-name
description: ghost-role-information-mouse-description description: ghost-role-information-mouse-description
- type: Speech - type: Speech

View File

@@ -138,6 +138,8 @@
- type: GhostTakeoverAvailable - type: GhostTakeoverAvailable
prob: 0.33 prob: 0.33
name: space carp on salvage wreck name: space carp on salvage wreck
allowMovement: true
allowSpeech: true
description: | description: |
Defend the loot inside the salvage wreck! Defend the loot inside the salvage wreck!
- type: SalvageMobRestrictions - type: SalvageMobRestrictions
@@ -149,6 +151,8 @@
parent: BaseMobCarp parent: BaseMobCarp
components: components:
- type: GhostTakeoverAvailable - type: GhostTakeoverAvailable
allowMovement: true
allowSpeech: true
makeSentient: true makeSentient: true
name: Sentient Carp name: Sentient Carp
description: Help the dragon flood the station with carps! description: Help the dragon flood the station with carps!

View File

@@ -86,6 +86,8 @@
- id: FoodMeatXeno - id: FoodMeatXeno
amount: 5 amount: 5
- type: GhostTakeoverAvailable - type: GhostTakeoverAvailable
allowMovement: true
allowSpeech: true
makeSentient: true makeSentient: true
name: xeno name: xeno
description: You are a xeno, co-operate with your hive to kill all crewmembers! description: You are a xeno, co-operate with your hive to kill all crewmembers!

View File

@@ -6,6 +6,8 @@
description: A flying leviathan, loosely related to space carps. description: A flying leviathan, loosely related to space carps.
components: components:
- type: GhostTakeoverAvailable - type: GhostTakeoverAvailable
allowMovement: true
allowSpeech: true
makeSentient: true makeSentient: true
name: Space dragon name: Space dragon
description: Call in 3 carp rifts and take over this quadrant! You have only 5 minutes in between each rift before you will disappear. description: Call in 3 carp rifts and take over this quadrant! You have only 5 minutes in between each rift before you will disappear.

View File

@@ -6,6 +6,8 @@
components: components:
- type: GhostTakeoverAvailable - type: GhostTakeoverAvailable
makeSentient: true makeSentient: true
allowMovement: true
allowSpeech: true
name: Remilia, the chaplain's familiar name: Remilia, the chaplain's familiar
description: Obey your master. Eat fruit. description: Obey your master. Eat fruit.
rules: You are an intelligent fruit bat. Follow the chaplain around. Don't cause any trouble unless the chaplain tells you to. rules: You are an intelligent fruit bat. Follow the chaplain around. Don't cause any trouble unless the chaplain tells you to.
@@ -32,6 +34,8 @@
components: components:
- type: GhostTakeoverAvailable - type: GhostTakeoverAvailable
makeSentient: true makeSentient: true
allowMovement: true
allowSpeech: true
name: Cerberus, Evil Familiar name: Cerberus, Evil Familiar
description: Obey your master. Spread chaos. description: Obey your master. Spread chaos.
rules: You are an intelligent, demonic dog. Try to help the chaplain and any of his flock. As an antagonist, you're otherwise unrestrained. rules: You are an intelligent, demonic dog. Try to help the chaplain and any of his flock. As an antagonist, you're otherwise unrestrained.

View File

@@ -7,6 +7,8 @@
save: false save: false
components: components:
- type: GhostTakeoverAvailable - type: GhostTakeoverAvailable
allowMovement: true
allowSpeech: true
makeSentient: true makeSentient: true
name: Guardian name: Guardian
description: Listen to your owner. Don't tank damage. Punch people hard. description: Listen to your owner. Don't tank damage. Punch people hard.
@@ -103,6 +105,8 @@
description: A mesmerising whirl of hard-light patterns weaves a marvelous, yet oddly familiar visage. It stands proud, tuning into its owner's life to sustain itself. description: A mesmerising whirl of hard-light patterns weaves a marvelous, yet oddly familiar visage. It stands proud, tuning into its owner's life to sustain itself.
components: components:
- type: GhostTakeoverAvailable - type: GhostTakeoverAvailable
allowMovement: true
allowSpeech: true
makeSentient: true makeSentient: true
name: Holoparasite name: Holoparasite
description: Listen to your owner. Don't tank damage. Punch people hard. description: Listen to your owner. Don't tank damage. Punch people hard.
@@ -127,6 +131,8 @@
description: A corrupted jinn, ripped from fitra to serve the wizard's petty needs. It stands wicked, tuning into it's owner's life to sustain itself. description: A corrupted jinn, ripped from fitra to serve the wizard's petty needs. It stands wicked, tuning into it's owner's life to sustain itself.
components: components:
- type: GhostTakeoverAvailable - type: GhostTakeoverAvailable
allowMovement: true
allowSpeech: true
makeSentient: true makeSentient: true
name: Ifrit name: Ifrit
description: Listen to your owner. Don't tank damage. Punch people hard. description: Listen to your owner. Don't tank damage. Punch people hard.