Skip to content
24 changes: 24 additions & 0 deletions Content.Server/EntityEffects/Effects/LactozitIntolerance.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/// Forge Change Start
using Content.Server.Traits.Assorted;
using Content.Shared.EntityEffects;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;

namespace Content.Server.EntityEffects.Effects;

/// <summary>
/// Triggers a unique reaction on entities with Lactozit intolerance.
/// </summary>
[UsedImplicitly]
public sealed partial class LactozitIntolerance : EntityEffect
{
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("reagent-effect-guidebook-lactozitium-reaction", ("chance", Probability));

public override void Effect(EntityEffectBaseArgs args)
{
args.EntityManager.EntitySysManager.GetEntitySystem<LactozitIntoleranceSystem>()
.TryTriggerLactozitiumReaction(args.TargetEntity);
}
}
/// Forge Change End
18 changes: 18 additions & 0 deletions Content.Server/_Forge/Traits/LactozitIntoleranceComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Numerics;

namespace Content.Server.Traits.Assorted;

/// <summary>
/// This is used for the Lactozit Intolerance trait.
/// </summary>
[RegisterComponent, Access(typeof(LactozitIntoleranceSystem))]
public sealed partial class LactozitIntoleranceComponent : Component
{
/// <summary>
/// The random cooldown between Lactozitium incidents, (min, max).
/// </summary>
[DataField("timeBetweenIncidents", required: true)]
public Vector2 TimeBetweenIncidents { get; private set; }

public float TimeUntilNextIncident;
}
69 changes: 69 additions & 0 deletions Content.Server/_Forge/Traits/LactozitIntoleranceSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using Content.Server.Chat.Systems;
using Content.Server.Medical;
using Content.Server.Popups;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Random;
using Robust.Shared.Player;

namespace Content.Server.Traits.Assorted;

/// <summary>
/// This handles Lactozit intolerance incidents when Lactozit is metabolized.
/// </summary>
public sealed partial class LactozitIntoleranceSystem : EntitySystem
{
[Dependency] private ChatSystem _chat = default!;
[Dependency] private SharedAudioSystem _audio = default!;
[Dependency] private PopupSystem _popup = default!;
[Dependency] private IRobustRandom _random = default!;
[Dependency] private VomitSystem _vomit = default!;

public void TryTriggerLactozitiumReaction(EntityUid uid, LactozitIntoleranceComponent? intolerance = null)
{
if (!Resolve(uid, ref intolerance, false))
return;

if (intolerance.TimeUntilNextIncident > 0)
return;

intolerance.TimeUntilNextIncident =
_random.NextFloat(intolerance.TimeBetweenIncidents.X, intolerance.TimeBetweenIncidents.Y);

BloatingEffect(uid);

}

public override void Update(float frameTime)
{
base.Update(frameTime);

var query = EntityQueryEnumerator<LactozitIntoleranceComponent>();
while (query.MoveNext(out _, out var intolerance))
{
if (intolerance.TimeUntilNextIncident <= 0)
continue;

intolerance.TimeUntilNextIncident -= frameTime;
}
}
public void BloatingEffect(EntityUid uid){
switch (_random.Next(3))
{
case 0:
{
_audio.PlayPvs(new SoundCollectionSpecifier("Parp"), uid, AudioParams.Default.WithVariation(0.125f));
var fartMessage = Loc.GetString("trait-lactozit-intolerance-fart", ("entity", uid));
_popup.PopupEntity(fartMessage, uid, Filter.PvsExcept(uid), true);
_popup.PopupEntity(fartMessage, uid, uid);
break;
}
case 1:
_chat.TryEmoteWithChat(uid, "Belch", ignoreActionBlocker: true, forceEmote: true);
break;
case 2:
_vomit.Vomit(uid);
break;
}
}
}
6 changes: 6 additions & 0 deletions Resources/Locale/en-US/guidebook/chemistry/effects.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,12 @@ reagent-effect-guidebook-reset-narcolepsy =
*[other] temporarily stave
} off narcolepsy

reagent-effect-guidebook-lactozitium-reaction =
{ $chance ->
[1] Triggers
*[other] trigger
} farting, vomiting, and burping in Lactozit-intolerant metabolisms

reagent-effect-guidebook-wash-cream-pie-reaction =
{ $chance ->
[1] Washes
Expand Down
5 changes: 5 additions & 0 deletions Resources/Locale/en-US/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ trait-poor-vision-desc = Your eyes are not what they once were, you have difficu
trait-narcolepsy-name = Narcolepsy
trait-narcolepsy-desc = You fall asleep randomly.

trait-lactozit-intolerance-name = Lactozit intolerance
trait-lactozit-intolerance-desc = Lactozitium makes you fart, vomit, and burp uncontrollably.

trait-pacifist-name = Pacifist
trait-pacifist-desc = You cannot attack or hurt any living beings.

Expand Down Expand Up @@ -69,3 +72,5 @@ trait-painnumbness-desc = You lack any sense of feeling pain, being unaware of h
# Mono
trait-russian-name = Russian accent
trait-russian-desc = You reek of vodka smell.

trait-lactozit-intolerance-fart = { CAPITALIZE(THE($entity)) } lets out an awful burst of gas!
5 changes: 5 additions & 0 deletions Resources/Locale/ru-RU/guidebook/chemistry/effects.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ reagent-effect-guidebook-reset-narcolepsy =
[1] Предотвращает
*[other] предотвращают
} приступы нарколепсии
reagent-effect-guidebook-lactozitium-reaction =
{ $chance ->
[1] Вызывает
*[other] вызывают
} приступ газов, рвоты и отрыжки у существ с непереносимостью лактозита
reagent-effect-guidebook-wash-cream-pie-reaction =
{ $chance ->
[1] Смывает
Expand Down
4 changes: 4 additions & 0 deletions Resources/Locale/ru-RU/traits/traits.ftl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
trait-blindness-name = Слепота
trait-blindness-desc = Вы совершенно слепы и не можете видеть дальше нескольких метров перед собой.
trait-narcolepsy-name = Нарколепсия
trait-lactozit-intolerance-name = Непереносимость лактозита
trait-poor-vision-name = Близорукость
trait-poor-vision-desc = Ваши глаза уже не те, что раньше, и вы с трудом видите предметы вдали без корректирующих очков.
trait-narcolepsy-desc = Вас одолевают приступы сонливости
trait-lactozit-intolerance-desc = Лактозит заставляет вас неконтролируемо пускать газы, блевать и рыгать.
trait-pacifist-name = Пацифист
trait-pacifist-desc = Вы не можете нападать и причинять вред живым существам.
permanent-blindness-trait-examined = [color=lightblue]{ CAPITALIZE(POSS-PRONOUN($target)) } глаза остекленелые и расфокусированные. Не похоже, что { SUBJECT($target) } может хорошо вас видеть, если может вообще.[/color]
Expand Down Expand Up @@ -48,3 +50,5 @@ trait-painnumbness-desc = Вы не чувствуете боли и не осо
# Mono
trait-russian-name = Русский акцент
trait-russian-desc = От вас ощутимо пахнет водкой.

trait-lactozit-intolerance-fart = { CAPITALIZE(THE($entity)) } выпускает отвратительный залп газов!
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,8 @@
Quantity: 1
- ReagentId: Flavorol
Quantity: 1
- ReagentId: Lactozit # Forge-change
Quantity: 0.75 # Forge-change
# Tastes like bread, butter.

- type: entity
Expand All @@ -910,6 +912,8 @@
Quantity: 2
- ReagentId: Flavorol
Quantity: 1
- ReagentId: Lactozit # Forge-change
Quantity: 0.25 # Forge-change
# Tastes like bread, butter.

- type: entity
Expand Down
Loading
Loading