Ratvarian Language and CogChamp (#15639)

This commit is contained in:
keronshb
2023-04-29 04:34:19 -04:00
committed by GitHub
parent 46dc364dc8
commit 0f7e7da450
17 changed files with 236 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
using Content.Shared.Speech.EntitySystems;
namespace Content.Client.Speech.EntitySystems;
public sealed class RatvarianLanguageSystem : SharedRatvarianLanguageSystem
{
}

View File

@@ -0,0 +1,115 @@
using System.Text;
using System.Text.RegularExpressions;
using Content.Shared.Speech.Components;
using Content.Shared.Speech.EntitySystems;
using Content.Shared.StatusEffect;
namespace Content.Server.Speech.EntitySystems;
public sealed class RatvarianLanguageSystem : SharedRatvarianLanguageSystem
{
[Dependency] private readonly StatusEffectsSystem _statusEffects = default!;
private const string RatvarianKey = "RatvarianLanguage";
// This is the word of Ratvar and those who speak it shall abide by His rules:
/*
* Any time the word "of" occurs, it's linked to the previous word by a hyphen: "I am-of Ratvar"
* Any time "th", followed by any two letters occurs, you add a grave (`) between those two letters: "Thi`s"
* In the same vein, any time "ti" followed by one letter occurs, you add a grave (`) between "i" and the letter: "Ti`me"
* Wherever "te" or "et" appear and there is another letter next to the "e", add a hyphen between "e" and the letter: "M-etal/Greate-r"
* Where "gua" appears, add a hyphen between "gu" and "a": "Gu-ard"
* Where the word "and" appears it's linked to all surrounding words by hyphens: "Sword-and-shield"
* Where the word "to" appears, it's linked to the following word by a hyphen: "to-use"
* Where the word "my" appears, it's linked to the following word by a hyphen: "my-light"
* Any Ratvarian proper noun is not translated: Ratvar, Nezbere, Sevtug, Nzcrentr and Inath-neq
* This only applies if they're being used as a proper noun: armorer/Nezbere
*/
private static Regex THPattern = new Regex(@"th\w\B", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex ETPattern = new Regex(@"\Bet", RegexOptions.Compiled);
private static Regex TEPattern = new Regex(@"te\B",RegexOptions.Compiled);
private static Regex OFPattern = new Regex(@"(\s)(of)");
private static Regex TIPattern = new Regex(@"ti\B", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex GUAPattern = new Regex(@"(gu)(a)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex ANDPattern = new Regex(@"\b(\s)(and)(\s)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex TOMYPattern = new Regex(@"(to|my)\s", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex ProperNouns = new Regex(@"(ratvar)|(nezbere)|(sevtuq)|(nzcrentr)|(inath-neq)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public override void Initialize()
{
// Activate before other modifications so translation works properly
SubscribeLocalEvent<RatvarianLanguageComponent, AccentGetEvent>(OnAccent, before: new[] {typeof(SharedSlurredSystem), typeof(SharedStutteringSystem)});
}
public override void DoRatvarian(EntityUid uid, TimeSpan time, bool refresh, StatusEffectsComponent? status = null)
{
if (!Resolve(uid, ref status, false))
return;
_statusEffects.TryAddStatusEffect<RatvarianLanguageComponent>(uid, RatvarianKey, time, refresh, status);
}
private void OnAccent(EntityUid uid, RatvarianLanguageComponent component, AccentGetEvent args)
{
args.Message = Translate(args.Message);
}
private string Translate(string message)
{
var ruleTranslation = message;
var finalMessage = new StringBuilder();
var newWord = new StringBuilder();
ruleTranslation = THPattern.Replace(ruleTranslation, "$&`");
ruleTranslation = TEPattern.Replace(ruleTranslation, "$&-");
ruleTranslation = ETPattern.Replace(ruleTranslation, "-$&");
ruleTranslation = OFPattern.Replace(ruleTranslation, "-$2");
ruleTranslation = TIPattern.Replace(ruleTranslation, "$&`");
ruleTranslation = GUAPattern.Replace(ruleTranslation, "$1-$2");
ruleTranslation = ANDPattern.Replace(ruleTranslation, "-$2-");
ruleTranslation = TOMYPattern.Replace(ruleTranslation, "$1-");
var temp = ruleTranslation.Split(' ');
foreach (var word in temp)
{
newWord.Clear();
if (ProperNouns.IsMatch(word))
newWord.Append(word);
else
{
for (int i = 0; i < word.Length; i++)
{
var letter = word[i];
if (letter >= 97 && letter <= 122)
{
var letterRot = letter + 13;
if (letterRot > 122)
letterRot -= 26;
newWord.Append((char) letterRot);
}
else if (letter >= 65 && letter <= 90)
{
var letterRot = letter + 13;
if (letterRot > 90)
letterRot -= 26;
newWord.Append((char) letterRot);
}
else
{
newWord.Append(word[i]);
}
}
}
finalMessage.Append(newWord + " ");
}
return finalMessage.ToString().Trim();
}
}

View File

@@ -18,7 +18,9 @@ public abstract class SharedDrunkSystem : EntitySystem
return; return;
if (applySlur) if (applySlur)
{
_slurredSystem.DoSlur(uid, TimeSpan.FromSeconds(boozePower), status); _slurredSystem.DoSlur(uid, TimeSpan.FromSeconds(boozePower), status);
}
if (TryComp<LightweightDrunkComponent>(uid, out var trait)) if (TryComp<LightweightDrunkComponent>(uid, out var trait))
boozePower *= trait.BoozeStrengthMultiplier; boozePower *= trait.BoozeStrengthMultiplier;

View File

@@ -0,0 +1,8 @@
using Robust.Shared.GameStates;
namespace Content.Shared.Speech.Components;
[RegisterComponent, NetworkedComponent]
public sealed class RatvarianLanguageComponent : Component
{
}

View File

@@ -0,0 +1,10 @@
using Content.Shared.StatusEffect;
namespace Content.Shared.Speech.EntitySystems;
public abstract class SharedRatvarianLanguageSystem : EntitySystem
{
public virtual void DoRatvarian(EntityUid uid, TimeSpan time, bool refresh, StatusEffectsComponent? status = null)
{
}
}

View File

@@ -0,0 +1,4 @@
- files: ["steam_woosh.ogg"]
license: "CC-BY-SA-3.0"
copyright: "Taken from Citadel Station"
source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/e575bd66854786eb9455eae6954d976cf13c66ea"

Binary file not shown.

View File

@@ -165,6 +165,7 @@ flavor-complex-atomic-cola = like hoarding bottle caps
flavor-complex-cuba-libre = like spiked cola flavor-complex-cuba-libre = like spiked cola
flavor-complex-gin-tonic = like spiked lemon-lime soda flavor-complex-gin-tonic = like spiked lemon-lime soda
flavor-complex-screwdriver = like spiked orange juice flavor-complex-screwdriver = like spiked orange juice
flavor-complex-cogchamp = like brass
### This is exactly what pilk tastes like. I'm not even joking. I might've been a little drunk though ### This is exactly what pilk tastes like. I'm not even joking. I might've been a little drunk though
flavor-complex-pilk = like sweet milk flavor-complex-pilk = like sweet milk

View File

@@ -205,6 +205,9 @@ reagent-desc-sbiten = A spicy Vodka! Might be a little hot for the little guys!
reagent-name-screwdriver-cocktail = screwdriver reagent-name-screwdriver-cocktail = screwdriver
reagent-desc-screwdriver-cocktail = Vodka, mixed with plain ol' orange juice. The result is surprisingly delicious. reagent-desc-screwdriver-cocktail = Vodka, mixed with plain ol' orange juice. The result is surprisingly delicious.
reagent-name-cogchamp = cogchamp
reagent-desc-cogchamp = Not even Ratvar's Four Generals could withstand this! Qevax Jryy!
reagent-name-silencer = silencer reagent-name-silencer = silencer
reagent-desc-silencer = A drink from Mime Heaven. reagent-desc-silencer = A drink from Mime Heaven.

View File

@@ -77,6 +77,7 @@
- Electrocution - Electrocution
- Drunk - Drunk
- SlurredSpeech - SlurredSpeech
- RatvarianLanguage
- PressureImmunity - PressureImmunity
- Muted - Muted
- ForcedSleep - ForcedSleep

View File

@@ -1611,6 +1611,23 @@
- type: Sprite - type: Sprite
sprite: Objects/Consumable/Drinks/screwdriverglass.rsi sprite: Objects/Consumable/Drinks/screwdriverglass.rsi
- type: entity
parent: DrinkGlassBase
id: DrinkCogChampBase
name: cogchamp glass
description: This mix of Cognac, Screwdriver and Welding Fuel will have you seeing His light surely!
components:
- type: SolutionContainerManager
solutions:
drink:
maxVol: 30
reagents:
- ReagentId: CogChamp
Quantity: 30
- type: Drink
- type: Sprite
sprite: Objects/Consumable/Drinks/cogchamp.rsi
- type: entity - type: entity
parent: DrinkGlassBase parent: DrinkGlassBase
id: DrinkSuiDreamGlass id: DrinkSuiDreamGlass

View File

@@ -484,6 +484,11 @@
flavorType: Complex flavorType: Complex
description: flavor-complex-cola description: flavor-complex-cola
- type: flavor
id: cogchamp
flavorType: Complex
description: flavor-complex-cogchamp
- type: flavor - type: flavor
id: vodka id: vodka
flavorType: Complex flavorType: Complex

View File

@@ -1127,6 +1127,29 @@
reagent: Ethanol reagent: Ethanol
amount: 0.15 amount: 0.15
- type: reagent
id: CogChamp
name: reagent-name-cogchamp
parent: BaseAlcohol
desc: reagent-desc-cogchamp
physicalDesc: reagent-physical-desc-ground-brass
flavor: cogchamp
color: "#B5A642"
metamorphicSprite:
sprite: Objects/Consumable/Drinks/cogchamp.rsi
state: icon
metabolisms:
Drink:
effects:
- !type:GenericStatusEffect
key: RatvarianLanguage
component: RatvarianLanguage
- !type:SatiateThirst
factor: 2
- !type:AdjustReagent
reagent: Ethanol
amount: 0.15
- type: reagent - type: reagent
id: Silencer id: Silencer
name: reagent-name-silencer name: reagent-name-silencer

View File

@@ -76,6 +76,20 @@
products: products:
B52: 3 B52: 3
- type: reaction
id: CogChamp
reactants:
Cognac:
amount: 1
ScrewdriverCocktail:
amount: 1
WeldingFuel:
amount: 1
products:
CogChamp: 3
sound:
path: /Audio/Magic/Cults/ClockCult/steam_whoosh.ogg
- type: reaction - type: reaction
id: Barefoot id: Barefoot
reactants: reactants:

View File

@@ -53,3 +53,6 @@
- type: statusEffect - type: statusEffect
id: Pacified #cannot attack id: Pacified #cannot attack
- type: statusEffect
id: RatvarianLanguage #Praise him

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,22 @@
{
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "CC-BY-SA-3.0",
"copyright": "Made by keronshb for Citadel Station at: https://github.com/Citadel-Station-13/Citadel-Station-13/commit/c790478a3d6e8a2846e658c3dc6c5164737e4b42",
"states": [
{
"name": "icon",
"delays": [
[
0.6,
0.3,
0.3,
0.3
]
]
}
]
}