forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d67d6f
commit 968644c
Showing
3 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; | ||
|
||
namespace Content.Server._Arc.OuijiBoard; | ||
|
||
[RegisterComponent, AutoGenerateComponentPause] | ||
public sealed partial class OuijiBoardComponent : Component | ||
{ | ||
// Minimum time between each phrase, to prevent spam | ||
[DataField] | ||
public TimeSpan Cooldown = TimeSpan.FromSeconds(10); | ||
|
||
// Time that the next phrase can be sent. | ||
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField] | ||
public TimeSpan NextPhrase; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using Content.Server.Abilities.Mime; | ||
using Content.Server.Chat.Systems; | ||
using Content.Server.Speech.Components; | ||
using Content.Shared.Chat; | ||
using Content.Shared.DeltaV.AACTablet; | ||
using Content.Shared.IdentityManagement; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Timing; | ||
|
||
namespace Content.Server._Arc.OuijiBoard; | ||
|
||
public sealed class OuijiBoardSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly ChatSystem _chat = default!; | ||
[Dependency] private readonly IGameTiming _timing = default!; | ||
[Dependency] private readonly IPrototypeManager _prototype = default!; | ||
[Dependency] private readonly MimePowersSystem _mimePowers = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<OuijiBoardComponent, AACTabletSendPhraseMessage>(OnSendPhrase); | ||
} | ||
|
||
private void OnSendPhrase(Entity<OuijiBoardComponent> ent, ref AACTabletSendPhraseMessage message) | ||
{ | ||
if (ent.Comp.NextPhrase > _timing.CurTime) | ||
return; | ||
|
||
var senderName = Identity.Entity(message.Actor, EntityManager); | ||
var speakerName = Loc.GetString("speech-name-relay", | ||
("speaker", Name(ent)), | ||
("originalName", "Ghost")); | ||
|
||
if (!_prototype.TryIndex(message.PhraseId, out var phrase)) | ||
return; | ||
|
||
if (HasComp<MimePowersComponent>(message.Actor)) | ||
_mimePowers.BreakVow(message.Actor); | ||
|
||
EnsureComp<VoiceOverrideComponent>(ent).NameOverride = speakerName; | ||
|
||
_chat.TrySendInGameICMessage(ent, | ||
Loc.GetString(phrase.Text), | ||
InGameICChatType.Speak, | ||
hideChat: false, | ||
nameOverride: speakerName); | ||
|
||
var curTime = _timing.CurTime; | ||
ent.Comp.NextPhrase = curTime + ent.Comp.Cooldown; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
Resources/Prototypes/_Arc/Entities/Objects/Devices/ouijiboard.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
- type: entity | ||
parent: BaseItem | ||
id: ouijiboard | ||
name: ouiji board | ||
description: board where not only human can use it but ghost as well... | ||
components: | ||
- type: Sprite | ||
sprite: DeltaV/Objects/Devices/tablets.rsi | ||
layers: | ||
- state: aac_tablet | ||
- state: aac_screen | ||
shader: unshaded | ||
state: icon | ||
- type: Item | ||
inhandVisuals: | ||
left: | ||
- state: aac-inhand-left | ||
- state: aac_screen-inhand-left | ||
shader: unshaded | ||
right: | ||
- state: aac-inhand-right | ||
- state: aac_screen-inhand-right | ||
shader: unshaded | ||
- type: ActivatableUI | ||
singleUser: false | ||
RequireActiveHand: false | ||
RequiredComplex: false | ||
key: enum.AACTabletKey.Key | ||
- type: Damageable | ||
damageContainer: Inorganic | ||
- type: Destructible | ||
thresholds: | ||
- trigger: | ||
!type:DamageTrigger | ||
damage: 100 | ||
behaviors: | ||
- !type:DoActsBehavior | ||
acts: [ "Destruction" ] | ||
- type: UserInterface | ||
interfaces: | ||
enum.AACTabletKey.Key: | ||
type: AACBoundUserInterface | ||
RequireInputValidation: false | ||
- type: Speech | ||
speechSounds: Alto | ||
- type: OuijiBoard | ||
- type: VoiceMask |