Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add borg censorship filter #2063

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Server.DeltaV.Speech.EntitySystems;

namespace Content.Server.DeltaV.Speech.Components;

[RegisterComponent]
[Access(typeof(CensoredAccentSystem))]
public sealed partial class CensoredAccentComponent : Component
{ }
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Content.Server.DeltaV.Speech.Components;
using Content.Server.Speech;
using Content.Server.Speech.EntitySystems;
using System.Text.RegularExpressions;

namespace Content.Server.DeltaV.Speech.EntitySystems;

public sealed class CensoredAccentSystem : EntitySystem
{
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<CensoredAccentComponent, AccentGetEvent>(OnAccentGet);
}

// converts left word when typed into the right word. For example typing you becomes ye.
public string Accentuate(string message, CensoredAccentComponent component)
{
var msg = message;

msg = _replacement.ApplyReplacements(msg, "censored");

return msg;
}

private void OnAccentGet(EntityUid uid, CensoredAccentComponent component, AccentGetEvent args)
{
args.Message = Accentuate(args.Message, component);
}
}
9 changes: 9 additions & 0 deletions Content.Server/Silicons/Borgs/BorgSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
using Content.Server.Explosion.EntitySystems;
using Content.Server.Hands.Systems;
using Content.Server.PowerCell;
using Content.Server.DeltaV.Speech.Components;
using Content.Shared.Access.Systems;
using Content.Shared.Alert;
using Content.Shared.Database;
using Content.Shared.Emag.Systems;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Item.ItemToggle.Components;
Expand Down Expand Up @@ -74,6 +76,7 @@ public override void Initialize()
SubscribeLocalEvent<BorgChassisComponent, PowerCellSlotEmptyEvent>(OnPowerCellSlotEmpty);
SubscribeLocalEvent<BorgChassisComponent, GetCharactedDeadIcEvent>(OnGetDeadIC);
SubscribeLocalEvent<BorgChassisComponent, ItemToggledEvent>(OnToggled);
SubscribeLocalEvent<CensoredAccentComponent, GotEmaggedEvent>(OnGotEmagged);

SubscribeLocalEvent<BorgBrainComponent, MindAddedMessage>(OnBrainMindAdded);
SubscribeLocalEvent<BorgBrainComponent, PointAttemptEvent>(OnBrainPointAttempt);
Expand Down Expand Up @@ -137,6 +140,12 @@ private void OnChassisInteractUsing(EntityUid uid, BorgChassisComponent componen
}
}

//emagged borgs will not have the chat censorship of NT borgs
protected void OnGotEmagged(EntityUid uid, CensoredAccentComponent component, ref GotEmaggedEvent args)
{
EntityManager.RemoveComponent<CensoredAccentComponent>(uid);
}

// todo: consider transferring over the ghost role? managing that might suck.
protected override void OnInserted(EntityUid uid, BorgChassisComponent component, EntInsertedIntoContainerMessage args)
{
Expand Down
8 changes: 8 additions & 0 deletions Content.Server/StationEvents/Events/IonStormRule.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using Content.Server.DeltaV.Speech.Components;
using Content.Server.Silicons.Laws;
using Content.Server.StationEvents.Components;
using Content.Shared.Administration.Logs;
Expand All @@ -11,6 +12,7 @@
using Content.Shared.Silicons.Laws;
using Content.Shared.Silicons.Laws.Components;
using Content.Shared.Station.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;

Expand Down Expand Up @@ -168,6 +170,12 @@ protected override void Started(EntityUid uid, IonStormRuleComponent comp, GameR
EnsureComp<SiliconLawProviderComponent>(ent);
var ev = new IonStormLawsEvent(laws);
RaiseLocalEvent(ent, ref ev);

// try to remove borg cencorship filter
if (RobustRandom.Prob(target.RemoveAccentChance))
{
EntityManager.RemoveComponent<CensoredAccentComponent>(ent);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public sealed partial class IonStormTargetComponent : Component
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float ShuffleChance = 0.2f;

/// <summary>
/// Chance to remove the borg censorship filter
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float RemoveAccentChance = 0.2f;
}

/// <summary>
Expand Down
Loading
Loading