Skip to content

Commit

Permalink
ouiji board added(not work yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
Creatorbot01 committed Feb 14, 2025
1 parent 8d67d6f commit 968644c
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Content.Server/_Arc/OuijiBoard/AACTabletComponent.cs
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;
}
52 changes: 52 additions & 0 deletions Content.Server/_Arc/OuijiBoard/AACTabletSystem.cs
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 Resources/Prototypes/_Arc/Entities/Objects/Devices/ouijiboard.yml
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

0 comments on commit 968644c

Please sign in to comment.