Skip to content

Commit

Permalink
Port Profanol with custom curse words (Goob-Station#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
Piras314 authored Aug 29, 2024
1 parent 5670b95 commit 322e76b
Show file tree
Hide file tree
Showing 11 changed files with 164 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// CREATED BY Goldminermac
// https://github.com/space-wizards/space-station-14/pull/31149
// LICENSED UNDER THE MIT LICENSE
// SEE README.MD AND LICENSE.TXT IN THE ROOT OF THIS REPOSITORY FOR MORE INFORMATION
using Content.Shared.Speech.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using System.Text;

namespace Content.Server.Speech.EntitySystems;

public sealed class VulgarAccentSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;

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

SubscribeLocalEvent<VulgarAccentComponent, AccentGetEvent>(OnAccentGet);
}

public string Accentuate(string message, VulgarAccentComponent component)
{
string[] messageWords = message.Split(" ");

for (int i = 0; i < messageWords.Length; i++)
{
//Every word has a percentage chance to be replaced by a random swear word from the component's array.
if (_random.Prob(component.SwearProb))
{
if (!_prototypeManager.TryIndex(component.Pack, out var messagePack))
return message;


string swearWord = _loc.GetString(_random.Pick(messagePack.Values));
messageWords[i] = swearWord;
}
}

return string.Join(" ", messageWords);
}

public void OnAccentGet(EntityUid uid, VulgarAccentComponent component, AccentGetEvent args)
{
args.Message = Accentuate(args.Message, component);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// CREATED BY Goldminermac
// https://github.com/space-wizards/space-station-14/pull/31149
// LICENSED UNDER THE MIT LICENSE
// SEE README.MD AND LICENSE.TXT IN THE ROOT OF THIS REPOSITORY FOR MORE INFORMATION
using Robust.Shared.GameStates;
using Content.Shared.Dataset;
using Robust.Shared.Prototypes;

namespace Content.Shared.Speech.Components;

[RegisterComponent, NetworkedComponent]
public sealed partial class VulgarAccentComponent : Component
{
[DataField]
public ProtoId<LocalizedDatasetPrototype> Pack = "SwearWords";

[DataField]
public float SwearProb = 0.5f;
}
13 changes: 13 additions & 0 deletions Resources/Locale/en-US/Goobstation/accent/vulgar.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# CREATED BY Goldminermac
# https://github.com/space-wizards/space-station-14/pull/31149
# LICENSED UNDER THE MIT LICENSE
# SEE README.MD AND LICENSE.TXT IN THE ROOT OF THIS REPOSITORY FOR MORE INFORMATION
accent-vulgar-words-1 = CRAP
accent-vulgar-words-2 = SHIT
accent-vulgar-words-3 = DAMN
accent-vulgar-words-4 = DAMN IT
accent-vulgar-words-5 = BASTARD
accent-vulgar-words-6 = SON OF A SKUB
accent-vulgar-words-7 = PIECE OF SHIT
accent-vulgar-words-8 = NIMWIT
accent-vulgar-words-9 = SKUB
2 changes: 2 additions & 0 deletions Resources/Locale/en-US/Goobstation/flavor/flavors.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
flavor-base-futuristic = futuristic
flavor-complex-cherry = like cherry
flavor-base-offensive = offensive
8 changes: 8 additions & 0 deletions Resources/Locale/en-US/Goobstation/reagents/meta/fun.ftl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
reagent-name-tranquility = tranquility
reagent-desc-tranquility = You feel oddly calm...
reagent-popup-tranquility = You feel oddly calm...
# CREATED BY Goldminermac
# https://github.com/space-wizards/space-station-14/pull/31149
# LICENSED UNDER THE MIT LICENSE
# SEE README.MD AND LICENSE.TXT IN THE ROOT OF THIS REPOSITORY FOR MORE INFORMATION
reagent-name-profanol = profanol
reagent-desc-profanol = A chemical compound known to make people compulsively swear. A ruiner of countless family reunions and funerals.
# END OF MIT-LICENSED CODE
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Mobs/Species/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
- Flashed
- RadiationProtection
- Drowsiness
- Vulgarity # Goobstation - add Profanol
- type: Body
prototype: Human
requiredLegs: 2
Expand Down
9 changes: 9 additions & 0 deletions Resources/Prototypes/Goobstation/Datasets/swear_words.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# CREATED BY Goldminermac
# https://github.com/space-wizards/space-station-14/pull/31149
# LICENSED UNDER THE MIT LICENSE
# SEE README.MD AND LICENSE.TXT IN THE ROOT OF THIS REPOSITORY FOR MORE INFORMATION
- type: localizedDataset
id: SwearWords
values:
prefix: accent-vulgar-words-
count: 9
10 changes: 10 additions & 0 deletions Resources/Prototypes/Goobstation/Flavors/flavors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@
id: cherry
flavorType: Complex
description: flavor-complex-cherry

# CREATED BY Goldminermac
# https://github.com/space-wizards/space-station-14/pull/31149
# LICENSED UNDER THE MIT LICENSE
# SEE README.MD AND LICENSE.TXT IN THE ROOT OF THIS REPOSITORY FOR MORE INFORMATION
- type: flavor
id: offensive
flavorType: Base
description: flavor-base-offensive
# END OF MIT-LICENSED CODE
22 changes: 22 additions & 0 deletions Resources/Prototypes/Goobstation/Reagents/fun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,25 @@
conditions:
- !type:ReagentThreshold
min: 25

# CREATED BY Goldminermac
# https://github.com/space-wizards/space-station-14/pull/31149
# LICENSED UNDER THE MIT LICENSE
# SEE README.MD AND LICENSE.TXT IN THE ROOT OF THIS REPOSITORY FOR MORE INFORMATION
- type: reagent
id: Profanol
name: reagent-name-profanol
group: Toxins
desc: reagent-desc-profanol
physicalDesc: reagent-physical-desc-pungent
flavor: offensive
color: "#BF5E5E"
slippery: true
metabolisms:
Poison:
metabolismRate: 0.10
effects:
- !type:GenericStatusEffect
key: Vulgarity
component: VulgarAccent
# END OF MIT-LICENSED CODE
22 changes: 21 additions & 1 deletion Resources/Prototypes/Goobstation/Recipes/Reactions/fun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,24 @@
amount: 20
effects:
- !type:CreateEntityReactionEffect
entity: SoapHomemadeBanana
entity: SoapHomemadeBanana

# CREATED BY Goldminermac
# https://github.com/space-wizards/space-station-14/pull/31149
# LICENSED UNDER THE MIT LICENSE
# SEE README.MD AND LICENSE.TXT IN THE ROOT OF THIS REPOSITORY FOR MORE INFORMATION
- type: reaction
id: Profanol
impact: Low
quantized: true
minTemp: 300
reactants:
THC:
amount: 3
Ethanol:
amount: 3
Mercury:
amount: 2
products:
Profanol: 10
# END OF MIT-LICENSED CODE
8 changes: 8 additions & 0 deletions Resources/Prototypes/Goobstation/status_effects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@
id: Stasis
alert: Stasis
alwaysAllowed: true

# CREATED BY Goldminermac
# https://github.com/space-wizards/space-station-14/pull/31149
# LICENSED UNDER THE MIT LICENSE
# SEE README.MD AND LICENSE.TXT IN THE ROOT OF THIS REPOSITORY FOR MORE INFORMATION
- type: statusEffect
id: Vulgarity
# END OF MIT-LICENSED CODE

0 comments on commit 322e76b

Please sign in to comment.